mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibRegex: Bail parsing class set characters upon early EOF
Otherwise, we reach a skip() invocation at the end of this function, which crashes due to EOF. Caught by test262.
This commit is contained in:
parent
32502fceed
commit
8b668da9d5
2 changed files with 22 additions and 0 deletions
|
@ -779,6 +779,23 @@ TEST_CASE(ECMA262_unicode_match)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(ECMA262_unicode_sets_parser_error)
|
||||
{
|
||||
struct _test {
|
||||
StringView pattern;
|
||||
regex::Error error;
|
||||
};
|
||||
|
||||
constexpr _test tests[] {
|
||||
{ "[[]"sv, regex::Error::InvalidPattern },
|
||||
};
|
||||
|
||||
for (auto test : tests) {
|
||||
Regex<ECMA262> re(test.pattern, (ECMAScriptFlags)regex::AllFlags::UnicodeSets);
|
||||
EXPECT_EQ(re.parser_result.error, test.error);
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE(ECMA262_unicode_sets_match)
|
||||
{
|
||||
struct _test {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue