mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 09:39:39 +00:00
LibRegex: Use the right offset when patching jumps through fork-trees
Fixes #4474.
This commit is contained in:
parent
8a398e7a88
commit
022cd1adca
Notes:
github-actions[bot]
2025-04-27 10:17:08 +00:00
Author: https://github.com/alimpfard
Commit: 022cd1adca
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4479
2 changed files with 3 additions and 1 deletions
|
@ -1560,7 +1560,7 @@ void Optimizer::append_alternation(ByteCode& target, Span<ByteCode> alternatives
|
||||||
target.append(static_cast<ByteCodeValueType>(OpCodeId::ForkJump));
|
target.append(static_cast<ByteCodeValueType>(OpCodeId::ForkJump));
|
||||||
patch_location = target.size();
|
patch_location = target.size();
|
||||||
should_negate = false;
|
should_negate = false;
|
||||||
patch_size = 2;
|
patch_size = 1;
|
||||||
target.append(static_cast<ByteCodeValueType>(0));
|
target.append(static_cast<ByteCodeValueType>(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1137,6 +1137,8 @@ TEST_CASE(optimizer_alternation)
|
||||||
Tuple { "(xxxxxxxxxxxxxxxxxxxxxxx|xxxxxxxxxxxxxxxxxxxxxxx)?b"sv, "xxxxxxxxxxxxxxxxxxxxxxx"sv, 0u },
|
Tuple { "(xxxxxxxxxxxxxxxxxxxxxxx|xxxxxxxxxxxxxxxxxxxxxxx)?b"sv, "xxxxxxxxxxxxxxxxxxxxxxx"sv, 0u },
|
||||||
// Don't take the jump in JumpNonEmpty with nonexistent checkpoints (also don't crash).
|
// Don't take the jump in JumpNonEmpty with nonexistent checkpoints (also don't crash).
|
||||||
Tuple { "(?!\\d*|[g-ta-r]+|[h-l]|\\S|\\S|\\S){,9}|\\S{7,8}|\\d|(?<wnvdfimiwd>)|[c-mj-tb-o]*|\\s"sv, "rjvogg7pm|li4nmct mjb2|pk7s8e0"sv, 0u },
|
Tuple { "(?!\\d*|[g-ta-r]+|[h-l]|\\S|\\S|\\S){,9}|\\S{7,8}|\\d|(?<wnvdfimiwd>)|[c-mj-tb-o]*|\\s"sv, "rjvogg7pm|li4nmct mjb2|pk7s8e0"sv, 0u },
|
||||||
|
// Use the right offset when patching jumps through a fork-tree
|
||||||
|
Tuple { "(?!a)|(?!a)b"sv, "b"sv, 0u },
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto& test : tests) {
|
for (auto& test : tests) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue