We found with our fuzzer that FLIF may crash when calling libpng12 png_create_read_struct_2 with some invalid png files (CRC error). From a gdb backtrace, it is like:
(gdb) run ./Output/crashes/FLIF_libpng12.png --overwrite /dev/null
Starting program: /home/gqy/Desktop/FLIF-Fuzz/install/usr/local/bin/flif ./Output/crashes/FLIF_libpng12.png --overwrite /dev/null
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Warning: expected ".png", ".pnm" or ".pam" file name extension for input file, trying anyway...
This does not look like a PNM file.
libpng error: PNG unsigned integer out of range.
Program received signal SIGABRT, Aborted.
0x00007ffff6318428 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/unix/sysv/linux/raise.c:54
54 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 0x00007ffff6318428 in __GI_raise (sig=sig@entry=6)
at ../sysdeps/unix/sysv/linux/raise.c:54
#1 0x00007ffff631a02a in __GI_abort () at abort.c:89
#2 0x00007ffff6c54a49 in png_create_read_struct_2 ()
from /lib/x86_64-linux-gnu/libpng12.so.0
#3 0x00007fffffffd9f0 in ?? ()
#4 0x000061600000ed80 in ?? ()
#5 0x00007fffffffda3c in ?? ()
#6 0x00007fffffffd4b0 in ?? ()
#7 0x00000000004af25a in image_load_png(char const*, Image&, metadata_options&)
()
#8 0x00000000004aabde in Image::load(char const*, metadata_options&) ()
#9 0x000000000048bfdf in encode_load_input_images(int, char**, std::vector<Image, std::allocator<Image> >&, flif_options&) ()
#10 0x000000000049a095 in handle_encode(int, char**, std::vector<Image, std::allocator<Image> >&, flif_options&) ()
#11 0x000000000040793e in main ()
We found with our fuzzer that FLIF may crash when calling libpng12
png_create_read_struct_2
with some invalid png files (CRC error). From a gdb backtrace, it is like:PoC file: