[stringtemplate-interest] [ST4-Beta3] Endless loop and OutOfMemoryError when processing invalid template

Terence Parr parrt at cs.usfca.edu
Sun Jan 30 10:56:16 PST 2011


fixed. added unit test.
T
On Jan 30, 2011, at 6:49 AM, Udo Borkowski wrote:

> Hi,
> 
> given this (invalid) template definition (using '$', '$' delimiter):
> 
> main() ::= <<
> $t()>
> >>
> 
> results in these errors:
> 
> sketchpad.stg 2:17: invalid character '>'
> sketchpad.stg 2:17: invalid character '<EOF>'
> sketchpad.stg 2:17: invalid character '<EOF>'
> sketchpad.stg 2:17: invalid character '<EOF>'
> sketchpad.stg 2:17: invalid character '<EOF>'
> sketchpad.stg 2:17: invalid character '<EOF>'
> .
> .
> .
> endlessly repeat the EOF error and finally ends with an 
> 
> java.lang.OutOfMemoryError: Java heap space
> 
> 
> To work around this issue I added a check for EOF at the end of STLexer#inside():
> 
> 	errMgr.lexerError(input.getSourceName(), "invalid character '"+str(c)+"'", templateToken, re);
> 	if (c==EOF) {
> 		return newToken(EOF_TYPE);
> 	}
> 	consume();
> 
> 
> Udo
> _______________________________________________
> stringtemplate-interest mailing list
> stringtemplate-interest at antlr.org
> http://www.antlr.org/mailman/listinfo/stringtemplate-interest

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/stringtemplate-interest/attachments/20110130/3b8b34c6/attachment.html 


More information about the stringtemplate-interest mailing list