LibWeb: Disallow empty font-language-override string values

This commit is contained in:
Tim Ledbetter 2025-06-14 08:43:52 +01:00 committed by Tim Flynn
commit c55f281475
Notes: github-actions[bot] 2025-06-14 20:06:16 +00:00
2 changed files with 7 additions and 3 deletions

View file

@ -2623,6 +2623,10 @@ RefPtr<CSSStyleValue const> Parser::parse_font_language_override_value(TokenStre
return nullptr;
}
auto length = string_value.code_points().length();
if (length == 0) {
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: Failed to parse font-language-override: <string> value is empty");
return nullptr;
}
if (length > 4) {
dbgln_if(CSS_PARSER_DEBUG, "CSSParser: Failed to parse font-language-override: <string> value \"{}\" is too long", string_value);
return nullptr;

View file

@ -2,11 +2,11 @@ Harness status: OK
Found 6 tests
4 Pass
2 Fail
5 Pass
1 Fail
Pass e.style['font-language-override'] = "auto" should not set the property value
Pass e.style['font-language-override'] = "normal \"ksw\"" should not set the property value
Pass e.style['font-language-override'] = "\"turkish\"" should not set the property value
Fail e.style['font-language-override'] = "\"xøx\"" should not set the property value
Fail e.style['font-language-override'] = "\"\"" should not set the property value
Pass e.style['font-language-override'] = "\"\"" should not set the property value
Pass e.style['font-language-override'] = "\"ENG \"" should not set the property value