ChrisDodd / btyacc

Backtracking yacc
18 stars 5 forks source link

Parser stack corruption: error during backtracking treated incorrectly like YYERROR #21

Closed teshields closed 6 years ago

teshields commented 7 years ago

I experienced a strange memory corruption problem during backtracking that I believe is due to an error in btyaccpa.ske:

I have a patch (attached) to btyaccpa.ske that avoids the problem, although I haven't dug into the skeleton code sufficiently to understand if the patch breaks something else.

I have also attached zip file containing an example that demonstrates the problem (the Makefile expects 'btyacc' and 'btyacc.bug' as 2 separate executables, built with and without the patch).

btyacc-20170602.btyaccpa.ske.patch.txt

btyacc-bug.zip

teshields commented 7 years ago

I forgot to note that the zip file includes the file 'test-input' that results in the parse stack corruption when the 'gc' executable is built with the distribution btyacc; with the patched btyacc, it parses with no problems.

teshields commented 7 years ago

I went back and looked at the version of btyaccpa.ske in the btyacc 3.0 distribution still available on the Siber Systems web site.

In the location of my patch, that old version of btyaccpa.ske is the same as my patch.

I haven't searched through the change history for btyaccpa.ske yet, but I assume that you made the change that my patch 'backs out' to address some other problem. So my patch may not be the end solution.

ChrisDodd commented 6 years ago

Fixed by 92963ccfda1eb774b65b666fc9ae9a0184ab1ad3.