[antlr-interest] C runtime: crash in dupNode; UP/DOWN/etc. missing factory?

Ned Gill thomas.gill at csr.com
Mon Jun 1 08:01:19 PDT 2009


Hi list,

I'm seeing a crash in dupNode in antlr3commontree.c in libantlr3c 3.1.3.  
dupNode is being called on a common tree node which has a null factory.

Edited stack trace from GDB:

dupNode (tree=0x97debe0)
     at antlr3commontree.c:402
getMissingSymbol (recognizer=0x97ec8f8, istream=0x97ea300, e=0x97ecba8,  
expectedTokenType=23, follow=0x81beca0)
     at antlr3treeparser.c:227
recoverFromMismatchedToken (recognizer=0x97ec8f8, ttype=23,  
follow=0x81beca0)
     at antlr3baserecognizer.c:1530
match (recognizer=0x97ec8f8, ttype=23, follow=0x81beca0)
     at antlr3baserecognizer.c:478
...


I believe the node it's trying to duplicate is one of  
stream->UP/DOWN/EOF_NODE/INVALID_NODE initialised in  
antlr3CommonTreeNodeStreamNew (in antlr3commontreenodestream.c). It looks  
like those nodes never have their factory set. Is is safe to create a new  
factory there just for those nodes? Is there a better fix I should  
consider?


Thanks,
Ned.



More information about the antlr-interest mailing list