lewdlime / abcm2ps

abcm2ps is a command line program which converts ABC to music sheet in PostScript or SVG format. It is an extension of abc2ps which may handle many voices per staff. abcm2ps is Copyright © 2014-2016 Jean-Francois Moine.
http://moinejf.free.fr/
GNU General Public License v3.0
82 stars 31 forks source link

Crash in abcm2ps at music.c:2142 #102

Closed irfanariq closed 3 years ago

irfanariq commented 3 years ago

Hello,

We are currently working on fuzz testing feature, and we found a crash on abcm2ps.

The stack traces are as follow:

ASAN:DEADLYSIGNAL
=================================================================
==30788==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000068 (pc 0x5555555e64da bp 0x000000000007 sp 0x7fffffffd380 T0)
==30788==The signal is caused by a READ memory access.
==30788==Hint: address points to the zero page.
    #0 0x5555555e64d9 in set_lines .../abcm2ps-git/music.c:2142
    #1 0x5555555e9a8b in cut_tune .../abcm2ps-git/music.c:2234
    #2 0x5555555e9a8b in output_music .../abcm2ps-git/music.c:5109
    #3 0x5555555fb1d8 in generate .../abcm2ps-git/parse.c:1042
    #4 0x5555555fc259 in gen_ly .../abcm2ps-git/parse.c:1063
    #5 0x55555560ad40 in do_tune .../abcm2ps-git/parse.c:3647
    #6 0x55555558b2b8 in abc_eof .../abcm2ps-git/abcparse.c:202
    #7 0x5555555cf21e in frontend .../abcm2ps-git/front.c:906
    #8 0x555555588734 in treat_file .../abcm2ps-git/abcm2ps.c:240
    #9 0x555555586fdd in main .../abcm2ps-git/abcm2ps.c:1041
    #10 0x7ffff66aabf6 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21bf6)
    #11 0x555555587829 in _start (.../abcm2ps-git/install_asan/bin/abcm2ps+0x33829)

AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV .../abcm2ps-git/music.c:2142 in set_lines
==30788==ABORTING

Here is the full stack trace : stacktrace_abcm2ps_1.zip

Step to reproduce

We configured abcm2ps using CFLAGS="-g -O0 -fsanitize=address" LDFLAGS="-g -O0 -fsanitize=address" ./configure --disable-shared and built in using make -j10; make install, and run it with:

./abcm2ps <attached file> -O /dev/null

Attachment: input_abcm2ps_1.zip

Environment

Thank you.

moinejf commented 3 years ago

The problem should be fixed with the commit 8ad4287.

irfanariq commented 3 years ago

Yes, I have tried and the problem did not occur anymore. I will close the issue.