Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template.ParseLiquid throws ArgumentOutOfRangeException #121

Closed
Metalnem opened this issue Jan 21, 2019 · 1 comment
Closed

Template.ParseLiquid throws ArgumentOutOfRangeException #121

Metalnem opened this issue Jan 21, 2019 · 1 comment
Labels

Comments

@Metalnem
Copy link

Template.ParseLiquid can sometimes throw ArgumentOutOfRangeException instead of storing error details in the resulting template. Here's the full program that reproduces this:

namespace Scriban.Run
{
  public class Program
  {
    public static void Main(string[] args)
    {
      Template.ParseLiquid(@"{%""\u""");
    }
  }
}

And here's the full stack trace:

Exception has occurred: CLR/System.ArgumentOutOfRangeException
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in Scriban.dll: 'The character '"' is not an hexa [0a-fA-F] character'
   at Scriban.Parsing.Util.HexToInt(Char c)
   at Scriban.Parsing.Parser.ParseString()
   at Scriban.Parsing.Parser.ParseExpression(ScriptNode parentNode, Boolean& hasAnonymousFunction, ScriptExpression parentExpression, Int32 precedence, ParseExpressionMode mode)
   at Scriban.Parsing.Parser.ExpectAndParseExpressionAndAnonymous(ScriptNode parentNode, Boolean& hasAnonymousFunction, ParseExpressionMode mode)
   at Scriban.Parsing.Parser.ParseExpressionStatement()
   at Scriban.Parsing.Parser.TryParseStatement(ScriptStatement parent, ScriptStatement& statement, Boolean& hasEnd)
   at Scriban.Parsing.Parser.ParseBlockStatement(ScriptStatement parentStatement)
   at Scriban.Parsing.Parser.Run()
   at Scriban.Template.ParseInternal(String text, String sourceFilePath)
   at Scriban.Template.ParseLiquid(String text, String sourceFilePath, Nullable`1 parserOptions, Nullable`1 lexerOptions)

I'm using .NET Core 2.2 and the latest NuGet alpha version of Scriban (2.0.0-alpha-005).

Found via SharpFuzz.

@xoofx
Copy link
Member

xoofx commented Mar 10, 2019

Fixed in 2.0.0+

@xoofx xoofx closed this as completed Mar 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants