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

null pointer deference in function gchord_width() in music.c #98

Closed
chibataiki opened this issue May 10, 2021 · 1 comment
Closed

null pointer deference in function gchord_width() in music.c #98

chibataiki opened this issue May 10, 2021 · 1 comment

Comments

@chibataiki
Copy link

chibataiki commented May 10, 2021

Hi ,
Null pointer deference was found in function gchord_width() in music.c.

version :
9fa642d

env:
ubuntu 20.04 x86_64
gcc version 9.3.0

reproduce:
./configure
make
./abcm2ps poc

null_pointer_music.c_gchord_width_880.zip

Here didn't check whether s2 is valid, add check here or the for loop above or more deeper.

debug info

─ source:music.c+880 ────
    875	 			for (s2 = s->ts_next; ; s2 = s2->ts_next) {
    876	 				if (s2 == s->next) {
    877	 					AT_LEAST(s->wr, rspc);
    878	 					break;
    879	 				}
 →  880	 				if (s2->sflags & S_SEQST)
    881	 					rspc -= 8;
    882	 			}
    883	 		}
    884	 		if (arspc != 0)
    885	 			AT_LEAST(s->wr, arspc);
── threads ────
[#0] Id 1, Name: "abcm2ps", stopped 0x55555557cbd8 in gchord_width (), reason: SIGSEGV
─── trace ────
[#0] 0x55555557cbd8 → gchord_width(s=0x55555560bd28, wlnote=8, wlw=8)
[#1] 0x555555580557 → set_width(s=0x55555560bd28)
[#2] 0x5555555809b4 → set_allsymwidth(last_s=0x0)
[#3] 0x555555583833 → output_music()
[#4] 0x55555558a177 → generate()
[#5] 0x55555558a177 → generate()
[#6] 0x55555558a5f8 → gen_ly(eob=0x0)
[#7] 0x555555590918 → do_tune()
[#8] 0x55555555eb7d → abc_eof()
[#9] 0x55555557ae6c → frontend(s=<optimized out>, ftype=<optimized out>, fname=<optimized out>, linenum=0xf)

@chibataiki
Copy link
Author

Tried and fix, thanks for the work .

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

No branches or pull requests

1 participant