LibRegex: Make FailForks fail all forks up to the last save point

This makes negative lookarounds with more than one fork behave
correctly.
Fixes #11350.
This commit is contained in:
Ali Mohammad Pur 2021-12-25 05:35:09 +03:30 committed by Andreas Kling
commit 1a35e27490
Notes: sideshowbarker 2024-07-17 22:11:15 +09:00
4 changed files with 30 additions and 15 deletions

View file

@ -973,3 +973,14 @@ TEST_CASE(posix_basic_dollar_is_literal)
EXPECT_EQ(re.match("123abc$", PosixFlags::Global).success, true);
}
}
TEST_CASE(negative_lookahead)
{
{
// Negative lookahead with more than 2 forks difference between lookahead init and finish.
Regex<ECMA262> re(":(?!\\^\\)|1)", ECMAScriptFlags::Global);
EXPECT_EQ(re.match(":^)").success, false);
EXPECT_EQ(re.match(":1").success, false);
EXPECT_EQ(re.match(":foobar").success, true);
}
}