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
80 stars 31 forks source link

Segment Fault draw.c:357 calculate_beam #75

Open PangPangpeng opened 3 years ago

PangPangpeng commented 3 years ago

gdb-peda$ set args ./pocs/poc3 gdb-peda$ run Starting program: /root/Intriguer/intriguer/opensoft/abc2music/origin/abcm2ps ./pocs/poc3 abcm2ps-8.14.9 (2020-06-21) File ./pocs/poc3 ./pocs/poc3:84:50: error: Bad character 84 (3cde c(3d/e/f/ |(3zcd (3z/c/d/ (3czc c(4d/e/f/z2-(3def | \ ^ ./pocs/poc3:87:48: error: Note too much dotted

Program received signal SIGSEGV, Segmentation fault. [----------------------------------registers-----------------------------------] RAX: 0x6f7eb8 --> 0x6f8108 --> 0x6f8358 --> 0x6f85a8 --> 0x6f87f8 --> 0x0 RBX: 0x0 RCX: 0xfffffffe RDX: 0x1cf8 RSI: 0x0 RDI: 0x0 RBP: 0x6f6f18 --> 0x6f7168 --> 0x6f73b8 --> 0x6f7608 --> 0x6f7a18 --> 0x6f7c68 (--> ...) RSP: 0x7fffffffddb0 --> 0xffff800000002201 RIP: 0x412850 (<calculate_beam+3328>: movss xmm5,DWORD PTR [r114+0x448620]) R8 : 0x0 R9 : 0x0 R10: 0x0 R11: 0xfffffffe R12: 0x0 R13: 0x2 R14: 0x7fffffffde20 --> 0x0 R15: 0x6f7c68 --> 0x6f7eb8 --> 0x6f8108 --> 0x6f8358 --> 0x6f85a8 --> 0x6f87f8 (--> ...) EFLAGS: 0x10246 (carry PARITY adjust ZERO sign trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------] 0x412842 <calculate_beam+3314>: jne 0x412a06 <calculate_beam+3766> 0x412848 <calculate_beam+3320>: movsx r11d,BYTE PTR [rax+0x5a] 0x41284d <calculate_beam+3325>: mov rcx,r11 => 0x412850 <calculate_beam+3328>: movss xmm5,DWORD PTR [r114+0x448620] 0x41285a <calculate_beam+3338>: cmp BYTE PTR [rax+0x58],0x0 0x41285e <calculate_beam+3342>: jle 0x412a1d <calculate_beam+3789> 0x412864 <calculate_beam+3348>: movsx r10d,BYTE PTR [rax+r10*1+0x3d] 0x41286a <calculate_beam+3354>: cmp r10b,0x1a [------------------------------------stack-------------------------------------] 0000| 0x7fffffffddb0 --> 0xffff800000002201 0008| 0x7fffffffddb8 --> 0x7fffffffddff --> 0x0 0016| 0x7fffffffddc0 --> 0x400 0024| 0x7fffffffddc8 --> 0x43000001001 0032| 0x7fffffffddd0 --> 0x80 0040| 0x7fffffffddd8 --> 0x0 0048| 0x7fffffffdde0 --> 0x6f6f18 --> 0x6f7168 --> 0x6f73b8 --> 0x6f7608 --> 0x6f7a18 (--> ...) 0056| 0x7fffffffdde8 --> 0x671620 --> 0x31 ('1') [------------------------------------------------------------------------------] Legend: code, data, rodata, value Stopped reason: SIGSEGV 0x0000000000412850 in calculate_beam (bm=bm@entry=0x7fffffffde20, s1=s1@entry=0x6f6f18) at draw.c:357 357 stem_err = min_tb[0][(unsigned) s->nflags]; gdb-peda$ bt

0 0x0000000000412850 in calculate_beam (bm=bm@entry=0x7fffffffde20, s1=s1@entry=0x6f6f18) at draw.c:357

1 0x000000000041923d in draw_sym_near () at draw.c:4129

2 0x0000000000429a2b in delayed_output (indent=0) at music.c:5063

3 output_music () at music.c:5118

4 0x000000000042e971 in generate () at parse.c:1042

5 0x000000000042ef78 in gen_ly (eob=eob@entry=0x0) at parse.c:1063

6 0x0000000000434a60 in do_tune () at parse.c:3636

7 0x00000000004088e2 in abc_parse (p=0x694560 "", fname=fname@entry=0x692560 "./pocs/poc3", ln=ln@entry=0x58) at abcparse.c:179

8 0x000000000041fa17 in txt_add_eos (fname=fname@entry=0x692560 "./pocs/poc3", linenum=linenum@entry=0x58) at front.c:379

9 0x0000000000420478 in frontend (

s=0x6940b3 "\nX:10\nT:Chords with many accidentals\nM: 6/8\nK: G\n[^c^d] [^c^e] [^c^f] [^c^g] [^c^a] [^c^b] |\\\n[^C^D] [^C^E] [^C^F] [^C^G] [^C^A] [^C^B] |\\\n[^c^d^e] [^c^d^f] [^c^f^g] [^c^f^a] [^c=d=f^g_a_b]  |]\n[^c^f^"...,
s@entry=0x6937a0 "% Sample file to test various features of abc2ps\n\nU: M = !tenuto!\t\t% abcm2ps: default M is lowermordent\n\n% abcm2ps >= 7.6.0 - definition of '...' (ellipsis) for PostScript\n%%glyph 2026 ellipsis\n\nX:1\nT"..., ftype=ftype@entry=0x0, fname=fname@entry=0x692560 "./pocs/poc3", linenum=<optimized out>, linenum@entry=0x0) at front.c:891

10 0x0000000000403fdd in treat_file (fn=0x7fffffffe78c "./pocs/poc3", ext=) at abcm2ps.c:240

11 0x0000000000403118 in main (argc=0x0, argc@entry=0x2, argv=, argv@entry=0x7fffffffe508) at abcm2ps.c:1041

12 0x00007ffff7724840 in __libc_start_main (main=0x4029e0
, argc=0x2, argv=0x7fffffffe508, init=, fini=, rtld_fini=, stack_end=0x7fffffffe4f8)

at ../csu/libc-start.c:291

13 0x0000000000403689 in _start ()

poc3.zip

moinejf commented 3 years ago

Fixed by commit #191fa55. Thanks.