File tree Expand file tree Collapse file tree
Handlebars/Compiler/Lexer/Parsers Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -723,5 +723,15 @@ public void LastLetterCutOff()
723723
724724 Assert . Equal ( "abcd" , templateOutput ) ;
725725 }
726+
727+ // Issue: https://github.com/Handlebars-Net/Handlebars.Net/issues/535
728+ // Issue refers to invalid template causing OutOfMemoryException
729+ [ Fact ]
730+ public void UnrecognisedExpressionThrowsOutOfMemoryException ( )
731+ {
732+ var source = "{{Name | invalid}}" ;
733+
734+ Assert . Throws < HandlebarsCompilerException > ( ( ) => Handlebars . Compile ( source ) ) ;
735+ }
726736 }
727737}
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ private static string AccumulateWord(ExtendedStringReader reader)
2323
2424 reader . Read ( ) ;
2525
26- while ( reader . Peek ( ) != '|' )
26+ while ( reader . Peek ( ) != '|' && reader . Peek ( ) != - 1 )
2727 {
2828 buffer . Append ( ( char ) reader . Read ( ) ) ;
2929 }
You can’t perform that action at this time.
0 commit comments