1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

LibRegex: Treat backwards jumps to IP 0 as normal backwards jumps too

This shows up in something like /\d+|x/, where the `+` ends up jumping
to the start of its own alternative.
This commit is contained in:
Ali Mohammad Pur 2023-08-16 19:48:50 +03:30 committed by Ali Mohammad Pur
parent 045880e6c7
commit 4d27257c45
2 changed files with 3 additions and 1 deletions

View file

@ -1051,6 +1051,8 @@ TEST_CASE(optimizer_alternation)
Tuple { "ab|ac|ad|bc"sv, "bc"sv, 2u },
// Should not crash on backwards jumps introduced by '.*'.
Tuple { "\\bDroid\\b.*Build|XT912|XT928|XT926|XT915|XT919|XT925|XT1021|\\bMoto E\\b|XT1068|XT1092|XT1052"sv, "XT1068"sv, 6u },
// Backwards jumps to IP 0 are normal jumps too.
Tuple { "^(\\d+|x)"sv, "42"sv, 2u },
};
for (auto& test : tests) {