LibWeb/SVG: Disallow negative stroke-dasharray 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

This commit is contained in:
Tim Ledbetter 2025-06-27 21:40:27 +01:00 committed by Jelle Raaijmakers
commit ac25f47e8f
Notes: github-actions[bot] 2025-06-27 21:01:48 +00:00
3 changed files with 44 additions and 0 deletions

View file

@ -2045,12 +2045,19 @@ RefPtr<CSSStyleValue const> Parser::parse_stroke_dasharray_value(TokenStream<Com
// A <dasharray> is a list of comma and/or white space separated <number> or <length-percentage> values. A <number> value represents a value in user units.
auto value = parse_number_value(tokens);
if (value && value->is_number() && value->as_number().value() < 0)
return {};
if (value) {
dashes.append(value.release_nonnull());
} else {
auto value = parse_length_percentage_value(tokens);
if (!value)
return {};
if (value->is_percentage() && value->as_percentage().value() < 0)
return {};
if (value->is_length() && value->as_length().length().raw_value() < 0)
return {};
dashes.append(value.release_nonnull());
}