saitoha / libsixel

A SIXEL encoder/decoder implementation derived from kmiya's sixel (https://github.com/saitoha/sixel).
MIT License
2.46k stars 82 forks source link

Invalid memory reference in function gif_out_code in fromgif.c #131

Open fgeek opened 4 years ago

fgeek commented 4 years ago

2020-01-30-img2sixel.gif.zip (SHA1: 2f4c111513a1f9eed9583d3318c3987fe7fe77f9) Tested commit: 6a5be8b72d84037b83a5ea838e17bcf372ab1d5f Credit: Henri Salo Tools: american fuzzy lop 2.53b, afl-utils Notes: looks similar to #122

$ ./bin/img2sixel --high-color 2020-01-30-img2sixel.gif 
AddressSanitizer:DEADLYSIGNAL
=================================================================
==10369==ERROR: AddressSanitizer: SEGV on unknown address 0x7ffdb7f28fd8 (pc 0x7f6f87b526c0 bp 0x000000007ffd sp 0x7ffdb7f08560 T0)
==10369==The signal is caused by a READ memory access.
    #0 0x7f6f87b526bf in gif_out_code /home/hsalo/src/libsixel/src/fromgif.c:283
    #1 0x7f6f87b526d5 in gif_out_code /home/hsalo/src/libsixel/src/fromgif.c:284
    #2 0x7f6f87b57a9c in gif_process_raster /home/hsalo/src/libsixel/src/fromgif.c:393
    #3 0x7f6f87b57a9c in gif_load_next /home/hsalo/src/libsixel/src/fromgif.c:502
    #4 0x7f6f87b57a9c in load_gif /home/hsalo/src/libsixel/src/fromgif.c:656
    #5 0x7f6f87b42331 in load_with_builtin /home/hsalo/src/libsixel/src/loader.c:908
    #6 0x7f6f87b4db39 in sixel_helper_load_image_file /home/hsalo/src/libsixel/src/loader.c:1418
    #7 0x7f6f87b6ae23 in sixel_encoder_encode /home/hsalo/src/libsixel/src/encoder.c:1743
    #8 0x55e0287979ba in main /home/hsalo/src/libsixel/converters/img2sixel.c:457
    #9 0x7f6f8740d09a in __libc_start_main ../csu/libc-start.c:308
    #10 0x55e028798419 in _start (/home/hsalo/builds/libsixel/6a5be8b72d84037b83a5ea838e17bcf372ab1d5f/bin/img2sixel+0x6419)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV /home/hsalo/src/libsixel/src/fromgif.c:283 in gif_out_code
==10369==ABORTING
fgeek commented 4 years ago

Thank you @saitoha for developing great open-source software :)