Reproducable crash

Alexander Strange astra... at gmail.com
Tue Jan 23 21:38:25 UTC 2007


The attached file causes "ragel" (not rlcodegen) to bus error.

Program received signal EXC_BAD_ACCESS, Could not access memory.
Reason: KERN_PROTECTION_FAILURE at address: 0x00000064
0x0002e355 in STable<SBstMapEl<int, Action*> >::length (this=0x64) at
../aapl/table.h:152
152                     { return data == 0 ? 0 : (((STabHead*)data) -
1)->tabLen; }
(gdb) bt
#0  0x0002e355 in STable<SBstMapEl<int, Action*> >::length (this=0x64)
at ../aapl/table.h:152
#1  0x00022432 in FsmAp::hasOutData (this=0x60a8c0, state=0x0) at
fsmap.cpp:790
#2  0x00020796 in FsmAp::mergeStatesLeaving (this=0x60a8c0,
md=@0xbfffeda4, destState=0x0, srcState=0x610af0) at fsmgraph.cpp:1178
#3  0x00021b7c in FsmAp::starOp (this=0x60a8c0) at fsmgraph.cpp:228
#4  0x000119f9 in FactorWithRep::walk (this=0x609c50, pd=0x600460) at
parsetree.cpp:1356
#5  0x00012316 in FactorWithAug::walk (this=0x609c80, pd=0x600460) at
parsetree.cpp:1109
#6  0x00012af9 in Term::walk (this=0x609cd0, pd=0x600460,
lastInSeq=true) at parsetree.cpp:845
#7  0x00012d5e in Expression::walk (this=0x609cf0, pd=0x600460,
lastInSeq=true) at parsetree.cpp:687
#8  0x00012f98 in Join::walk (this=0x609d10, pd=0x600460) at
parsetree.cpp:502
#9  0x000112b4 in JoinOrLm::walk (this=0x609d30, pd=0x600460) at
parsetree.cpp:446
#10 0x00011329 in VarDef::walk (this=0x609d70, pd=0x600460) at
parsetree.cpp:44
#11 0x00017cbb in ParseData::makeInstance (this=0x600460,
gdNode=0x609d40) at parsedata.cpp:1025
#12 0x00017ef6 in ParseData::makeAll (this=0x600460) at
parsedata.cpp:1141
#13 0x000180a1 in ParseData::prepareMachineGen (this=0x600460,
graphDictEl=0x0) at parsedata.cpp:1302
#14 0x00018184 in writeMachines (out=@0xa0b0a920, hostData=@0xbffff284,
inputFileName=0xbffff41c "SSATagParsing.m.rl") at parsedata.cpp:1368
#15 0x0000c66b in main (argc=2, argv=0xbffff300) at main.cpp:372

The error can be worked around by removing "crasher" from the "tag"
machine.

(The intent of this was to be able to match any text inside a special
tag as valid, so my added actions would clean tags out of the text even
if I hadn't implemented all the commands inside them.)

Some other issues I've noticed writing this (a parser for text style
annotations in a subtitle format):

1. I get a warning:
SSATagParsing.m.rl:200:28: warning: applying plus operator to a machine
that accpets zero length word

This is obviously misspelled. Besides that, is there a way to avoid
this? I really am scanning any text that may have optional special
codes in it at random places, and empty text is perfectly fine by me.

2. According to the graph, once inside the "tag" machine, it generates
transitions to reenter that state upon reading '{', or to enter the nl
machine upon '\'. tag and nl should be exclusive, according to:

				tag = "{" cmd* "}";

				nl = "\\" [Nn];

				special = nl % nl_handler |
						 (tag > enter_tag % exit_tag);

and it shouldn't be looking for either of those until it's met a '}'.
Am I wrong?

Finally, just as a feature request, the things I'm using actions for
some of the time seem too obvious. I use several just to save the
current buffer position, since all the ending actions get is a pointer
past the end of what they want to read, and one to reimplement strtod.
I don't want to use the full tokenizing machinery since I have the
entire buffer available at once, but I would like beginning positions
of machines.



More information about the ragel-users mailing list