packcc icon indicating copy to clipboard operation
packcc copied to clipboard

Null pointer error on broken grammar

Open dolik-rce opened this issue 9 months ago • 1 comments

Hello @arithy,

I have noticed very small bug that might crash PackCC, but only on some very broken grammars.

If there is only one rule and it contains syntax error, then null pointer is dereferenced at packcc.c:3148.

Grammar to test:

main <- ( "A"

If the grammar contains two or more rules, than it fails correctly (returns non-zero code, but doesn't crash).

I am aware that this is pretty far fetched corner case (I have only found it due to another bug in my application :slightly_smiling_face:) and it's up to you if you want to fix it or not. I just wanted to let you know.

dolik-rce avatar May 12 '24 15:05 dolik-rce

Hello @dolik-rce , thank you for the helpful report. It's caused by a careless mistake... I'll fix it.

arithy avatar May 13 '24 01:05 arithy

I have tested with the new code, issue is solved. Thank you.

dolik-rce avatar May 19 '24 09:05 dolik-rce