Prevent StackOverflow in case of unclosed property
@ -603,6 +603,10 @@ public class PathCompiler {
readPosition++;
}
if (inProperty){
fail("Property has not been closed - missing closing " + potentialStringDelimiter);
int endBracketIndex = path.indexOfNextSignificantChar(endPosition, CLOSE_SQUARE_BRACKET) + 1;
path.setPosition(endBracketIndex);
@ -322,5 +322,10 @@ public class JsonPathTest extends BaseTest {
@Test(expected = InvalidPathException.class)
//see https://github.com/json-path/JsonPath/issues/428
public void prevent_stack_overflow_error_when_unclosed_property() {
JsonPath.compile("$['boo','foo][?(@ =~ /bar/)]");