Permalink
Browse files

Fix infinite loop when parsing certain invalid cast expressions.

  • Loading branch information...
archiecobbs committed Nov 4, 2018
1 parent e3da164 commit 82d45657d9c72d9e584df6e2ae9204a5600ff290
@@ -1,3 +1,7 @@
Version Next
- Fixed infinite loop when parsing certain invalid cast expressions
Version 4.1.2 Released October 26, 2018
- Improved Raft performance under heavy load and/or with slow followers
@@ -28,7 +28,7 @@ public Node parse(ParseSession session, ParseContext ctx, boolean complete) {
// Try cast
final int start = ctx.getIndex();
final Matcher castMatcher = ctx.tryPattern("(?s)\\(\\s*(" + LiteralExprParser.CLASS_NAME_PATTERN + ")\\s*\\)\\s*(?=.)");
while (castMatcher != null) {
if (castMatcher != null) {
final String className = castMatcher.group(1).replaceAll("\\s", "");
// Parse target of cast
@@ -429,6 +429,7 @@ public void testExprParse(String expr, Object expected) {
{ "(null)",
null },
{ "System.out.println(\"foobar\")", null },
{ "(float)s1", PARSE_FAIL },
// Non-public methods
{ "new java.util.ArrayList().ensureCapacityInternal(10)",

0 comments on commit 82d4565

Please sign in to comment.