Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVIF tests fail and AVIF support #764

Closed
pierrejoye opened this issue Sep 13, 2021 · 6 comments · Fixed by #769
Closed

AVIF tests fail and AVIF support #764

pierrejoye opened this issue Sep 13, 2021 · 6 comments · Fixed by #769

Comments

@pierrejoye
Copy link
Contributor

pierrejoye commented Sep 13, 2021

I am not sure what happened but the tests leak below failed, leak or crash.

Would it be possible to clean that up? I am happy to help but so far my comments about AVIF support, what is it supposed to support, etc have no answer. I installed it from source to be able to test, current required version is not available in most distribution. I think it would be great to have actual documentation about it and what was planed to be added. What do you think?

Also as of now, I would like to mark it experimental, until libavif itself is not stable as well. Thoughts?

Using:
libavif 0.9.2 (git clone and install, no plugin)

➜  builds git:(master) ✗ ./Bin/test_avif_avif_im2im
GD Warning: AVIF image support has been disabled
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/avif_im2im.c:41: gdImageAvifPtr() returned null
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/avif_im2im.c:42: gdImageAvifPtr() returned a non-positive size
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/avif_im2im.c:46: gdImageAvifPtr() returned null
GD Warning: AVIF image support has been disabled
AddressSanitizer:DEADLYSIGNAL
=================================================================
==17174==ERROR: AddressSanitizer: SEGV on unknown address 0x000000001c78 (pc 0x7f64c1be298d bp 0x7ffdc3d815a0 sp 0x7ffdc3d81590 T0)
==17174==The signal is caused by a READ memory access.
    #0 0x7f64c1be298c in gdImageGetPixel /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:1452
    #1 0x7f64c1be2c46 in gdImageGetTrueColorPixel /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:1479
    #2 0x5589c88cee4a in gdTestImageDiff /home/pierre/projects/libgd/releases/libgd_2.3.3/tests/gdtest/gdtest.c:484
    #3 0x5589c88cdc54 in main /home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/avif_im2im.c:54
    #4 0x7f64c19e50b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
    #5 0x5589c88cd76d in _start (/home/pierre/projects/libgd/releases/libgd_2.3.3/builds/Bin/test_avif_avif_im2im+0x376d)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:1452 in gdImageGetPixel
==17174==ABORTING
➜  builds git:(master) ✗ ./Bin/test_avif_bad_input
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/bad_input.c:24: gdImageCreateFromAvif() failed
Destructor is executed
➜  builds git:(master) ✗ ./Bin/test_avif_compare_avif_to_png
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:47: baboon: gdImageAvifPtrEx failed
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:47: dice_with_alpha: gdImageAvifPtrEx failed
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:47: plum_blossom_12bit: gdImageAvifPtrEx failed
GD Warning: AVIF image support has been disabled
/home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:47: sunset: gdImageAvifPtrEx failed

=================================================================
==17383==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 22008 byte(s) in 3 object(s) allocated from:
    #0 0x7fb2b37b5bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7fb2b3641e23 in gdMalloc /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gdhelpers.c:75
    #2 0x7fb2b35cd84e in gdImageCreateTrueColor /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:304
    #3 0x7fb2b361c227 in gdImageCreateFromPngCtx /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:281
    #4 0x7fb2b361bac4 in gdImageCreateFromPng /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:169
    #5 0x561a3551d9b7 in main /home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:38
    #6 0x7fb2b33d70b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

Indirect leak of 319072 byte(s) in 444 object(s) allocated from:
    #0 0x7fb2b37b5dc6 in calloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10ddc6)
    #1 0x7fb2b3641e05 in gdCalloc /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gdhelpers.c:69
    #2 0x7fb2b35cda5f in gdImageCreateTrueColor /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:321
    #3 0x7fb2b361c227 in gdImageCreateFromPngCtx /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:281
    #4 0x7fb2b361bac4 in gdImageCreateFromPng /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:169
    #5 0x561a3551d9b7 in main /home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:38
    #6 0x7fb2b33d70b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

Indirect leak of 3552 byte(s) in 3 object(s) allocated from:
    #0 0x7fb2b37b5bc8 in malloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dbc8)
    #1 0x7fb2b3641e23 in gdMalloc /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gdhelpers.c:75
    #2 0x7fb2b35cd88a in gdImageCreateTrueColor /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd.c:310
    #3 0x7fb2b361c227 in gdImageCreateFromPngCtx /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:281
    #4 0x7fb2b361bac4 in gdImageCreateFromPng /home/pierre/projects/libgd/releases/libgd_2.3.3/src/gd_png.c:169
    #5 0x561a3551d9b7 in main /home/pierre/projects/libgd/releases/libgd_2.3.3/tests/avif/compare_avif_to_png.c:38
    #6 0x7fb2b33d70b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)

SUMMARY: AddressSanitizer: 344632 byte(s) leaked in 450 allocation(s).
@cmb69
Copy link
Contributor

cmb69 commented Sep 13, 2021

libavif 0.9.2 (git clone and install, no plugin)

Hmm, did you build a codec? If not, that should be reported; maybe it's GD Warning: AVIF image support has been disabled. But we should make sure there are no mem leaks/crashes in that case. Maybe it's helpful to see how libavif is build for PHP for Windows.

Also as of now, I would like to mark it experimental, until libavif itself is not stable as well.

Well, libavif is only one part of the stack; the other are the codecs. Anyway, documenting it as experimental doesn't appear to be bad (although AVIF support is supposed to ship with PHP 8.1.0, so users may use it nonetheless).

@pierrejoye
Copy link
Contributor Author

pierrejoye commented Sep 13, 2021 via email

@cmb69
Copy link
Contributor

cmb69 commented Sep 13, 2021

Yeah, AVIF is bleeding edge, but some downstream projects are eager to use it (cc @andypost). Im fine with marking the support as experimental for now.

@andypost
Copy link

Maybe it needs better processing when no codecs are available?
Lots of people using PHP via docker so it's pretty easy to add whatever customers need

@andypost
Copy link

Maybe support of libheif could help to get it for more platforms

@pierrejoye
Copy link
Contributor Author

pierrejoye commented Sep 13, 2021 via email

pierrejoye added a commit that referenced this issue Sep 14, 2021
pierrejoye added a commit that referenced this issue Sep 14, 2021
Fix #764 prevent crash in test code when AVIF encode/decode fails, fix leaks in tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants