mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-12 11:09:18 +00:00
LibRegex: Restore checkpoints when restoring the state post-fork
Fixes the lockup/OOM in #968.
This commit is contained in:
parent
43a07a0fde
commit
cc1f0c3af2
Notes:
github-actions[bot]
2024-10-09 09:21:57 +00:00
Author: https://github.com/alimpfard
Commit: cc1f0c3af2
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1684
3 changed files with 9 additions and 6 deletions
|
@ -705,6 +705,8 @@ TEST_CASE(ECMA262_match)
|
|||
{ "a$"sv, "a\r\n"sv, true, global_multiline.value() }, // $ should accept all LineTerminators in ECMA262 mode with Multiline.
|
||||
{ "^a"sv, "\ra"sv, true, global_multiline.value() },
|
||||
{ "^(.*?):[ \\t]*([^\\r\\n]*)$"sv, "content-length: 488\r\ncontent-type: application/json; charset=utf-8\r\n"sv, true, global_multiline.value() },
|
||||
{ "^\\?((&?category=[0-9]+)?(&?shippable=1)?(&?ad_type=demand)?(&?page=[0-9]+)?(&?locations=(r|d)_[0-9]+)?)+$"sv,
|
||||
"?category=54&shippable=1&baby_age=p,0,1,3"sv, false }, // ladybird#968, ?+ should not loop forever.
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
|
@ -981,6 +983,7 @@ TEST_CASE(theoretically_infinite_loop)
|
|||
"(a*?)*"sv, // Infinitely matching empty substrings, the outer loop should short-circuit.
|
||||
"(a*)*?"sv, // Should match exactly nothing.
|
||||
"(?:)*?"sv, // Should not generate an infinite fork loop.
|
||||
"(a?)+$"sv, // Infinitely matching empty strings, but with '+' instead of '*'.
|
||||
};
|
||||
for (auto& pattern : patterns) {
|
||||
Regex<ECMA262> re(pattern);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue