mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 04:09:13 +00:00
LibWeb: Don't crash with invalid transform-origin values
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
Some checks are pending
CI / macOS, arm64, Sanitizer_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Fuzzers_CI, Clang (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, GNU (push) Waiting to run
CI / Linux, x86_64, Sanitizer_CI, Clang (push) Waiting to run
Package the js repl as a binary artifact / Linux, arm64 (push) Waiting to run
Package the js repl as a binary artifact / macOS, arm64 (push) Waiting to run
Package the js repl as a binary artifact / Linux, x86_64 (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run
This commit is contained in:
parent
0e3386bb4c
commit
b8f78e3bc1
Notes:
github-actions[bot]
2025-07-01 13:20:25 +00:00
Author: https://github.com/Gingeh
Commit: b8f78e3bc1
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5265
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 12 additions and 3 deletions
|
@ -3907,14 +3907,14 @@ RefPtr<CSSStyleValue const> Parser::parse_transform_origin_value(TokenStream<Com
|
||||||
auto second_value = to_axis_offset(parse_css_value_for_property(PropertyID::TransformOrigin, tokens));
|
auto second_value = to_axis_offset(parse_css_value_for_property(PropertyID::TransformOrigin, tokens));
|
||||||
auto third_value = parse_length_value(tokens);
|
auto third_value = parse_length_value(tokens);
|
||||||
|
|
||||||
|
if (!first_value.has_value() || !second_value.has_value())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
if ((first_value->offset->is_length() || first_value->offset->is_percentage()) && second_value->axis == Axis::X)
|
if ((first_value->offset->is_length() || first_value->offset->is_percentage()) && second_value->axis == Axis::X)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
if ((second_value->offset->is_length() || second_value->offset->is_percentage()) && first_value->axis == Axis::Y)
|
if ((second_value->offset->is_length() || second_value->offset->is_percentage()) && first_value->axis == Axis::Y)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
if (!first_value.has_value() || !second_value.has_value())
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (!third_value)
|
if (!third_value)
|
||||||
third_value = zero_value;
|
third_value = zero_value;
|
||||||
|
|
||||||
|
|
1
Tests/LibWeb/Text/expected/invalid-transform-origin.txt
Normal file
1
Tests/LibWeb/Text/expected/invalid-transform-origin.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
PASS (didn't crash)
|
8
Tests/LibWeb/Text/input/invalid-transform-origin.html
Normal file
8
Tests/LibWeb/Text/input/invalid-transform-origin.html
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="include.js"></script>
|
||||||
|
<div style="transform-origin: bad value"></div>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
println("PASS (didn't crash)");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue