1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

LibRegex: Don't add the Repeat instruction size to its jump target

This was causing the calculated jump target to become invalid, leading
to possibly invalid optimisations and (more likely) crashes.
Fixes #21047.
This commit is contained in:
Ali Mohammad Pur 2023-09-14 05:43:29 +03:30 committed by Ali Mohammad Pur
parent 9220c68408
commit 4d71f4edc4
2 changed files with 4 additions and 2 deletions

View file

@ -1053,6 +1053,8 @@ TEST_CASE(optimizer_alternation)
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 },
// `Repeat' does not add its insn size to the jump target.
Tuple { "[0-9]{2}|[0-9]"sv, "92"sv, 2u },
};
for (auto& test : tests) {