Skip to content

Commit be96f4d

Browse files
committed
GenericRegex: don't throw/abort on syntax error (unclosed parenthesis).
1 parent 30d92a6 commit be96f4d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

include/rapidjson/internal/regex.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,7 @@ class GenericRegex {
395395
}
396396
return false;
397397

398-
default:
399-
RAPIDJSON_ASSERT(op == kOneOrMore);
398+
case kOneOrMore:
400399
if (operandStack.GetSize() >= sizeof(Frag)) {
401400
Frag e = *operandStack.template Pop<Frag>(1);
402401
SizeType s = NewState(kRegexInvalidState, e.start, 0);
@@ -405,6 +404,10 @@ class GenericRegex {
405404
return true;
406405
}
407406
return false;
407+
408+
default:
409+
// syntax error (e.g. unclosed kLeftParenthesis)
410+
return false;
408411
}
409412
}
410413

0 commit comments

Comments
 (0)