StubbleOrg / Stubble

Trimmed down {{mustache}} templates in .NET
Other
399 stars 58 forks source link

PartialTagParser exhaustion side effect?! #137

Open ProIcons opened 1 year ago

ProIcons commented 1 year ago

https://github.com/StubbleOrg/Stubble/blob/7e5bab6c69d90ab898b84c158969495c0e05bbac/src/Stubble.Core/Parser/TokenParsers/PartialTagParser.cs#L59-L62

This should throw an exception instead of returning false. At this point there's nothing in the Slice, and the parser is moving to the next InlineParser -> InterpolationTagParser which fails on

https://github.com/StubbleOrg/Stubble/blob/7e5bab6c69d90ab898b84c158969495c0e05bbac/src/Stubble.Core/Parser/TokenParsers/InterpolationTagParser.cs#L30

With IndexOutOfBounds Exception. While this indeed throws an exception, it doesn't throw it on the correct place.

If the intention is to support Parsers before the InterpolationTagParser with the ParserPipeline, then in that, if condition, the slice's start position should be reverted to its original, before returning false.