1
0
Fork 0
mirror of https://github.com/LadybirdBrowser/ladybird.git synced 2025-06-08 05:27:14 +09:00

LibRegex: Use the *actually* correct repeat start offset for Repeat

Fixes #2931 and various frequent crashes.
This commit is contained in:
Ali Mohammad Pur 2024-12-23 12:16:08 +01:00 committed by Jelle Raaijmakers
parent 5c032583b4
commit 50733c564c
Notes: github-actions[bot] 2024-12-23 12:14:51 +00:00
2 changed files with 6 additions and 1 deletions

View file

@ -98,7 +98,7 @@ typename Regex<Parser>::BasicBlockList Regex<Parser>::split_basic_blocks(ByteCod
case OpCodeId::Repeat: {
// Repeat produces two blocks, one containing its repeated expr, and one after that.
auto& repeat = static_cast<OpCode_Repeat const&>(opcode);
auto repeat_start = state.instruction_position - repeat.offset() - repeat.size();
auto repeat_start = state.instruction_position - repeat.offset();
if (repeat_start > end_of_last_block)
block_boundaries.append({ end_of_last_block, repeat_start, "Repeat"sv });
block_boundaries.append({ repeat_start, state.instruction_position, "Repeat after"sv });