Merge pull request #1416 from ylavic/regex_syntax_noassert
GenericRegex: don't throw/abort on syntax error (unclosed parenthesis).
This commit is contained in:
commit
eea3e57bcf
@ -395,8 +395,7 @@ private:
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
RAPIDJSON_ASSERT(op == kOneOrMore);
|
||||
case kOneOrMore:
|
||||
if (operandStack.GetSize() >= sizeof(Frag)) {
|
||||
Frag e = *operandStack.template Pop<Frag>(1);
|
||||
SizeType s = NewState(kRegexInvalidState, e.start, 0);
|
||||
@ -405,6 +404,10 @@ private:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
default:
|
||||
// syntax error (e.g. unclosed kLeftParenthesis)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -595,6 +595,7 @@ TEST(Regex, Invalid) {
|
||||
TEST_INVALID("");
|
||||
TEST_INVALID("a|");
|
||||
TEST_INVALID("()");
|
||||
TEST_INVALID("(");
|
||||
TEST_INVALID(")");
|
||||
TEST_INVALID("(a))");
|
||||
TEST_INVALID("(a|)");
|
||||
|
Loading…
x
Reference in New Issue
Block a user