diff --git a/Tests/LibWeb/Text/expected/css/unicode-range-all-wildcard.txt b/Tests/LibWeb/Text/expected/css/unicode-range-all-wildcard.txt new file mode 100644 index 00000000000..aaecaf93c4a --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/unicode-range-all-wildcard.txt @@ -0,0 +1 @@ +PASS (didn't crash) diff --git a/Tests/LibWeb/Text/input/css/unicode-range-all-wildcard.html b/Tests/LibWeb/Text/input/css/unicode-range-all-wildcard.html new file mode 100644 index 00000000000..5ea5fd4aabb --- /dev/null +++ b/Tests/LibWeb/Text/input/css/unicode-range-all-wildcard.html @@ -0,0 +1,11 @@ + + + diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index 91329178db7..c73186a23b5 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2217,6 +2217,7 @@ Optional Parser::parse_unicode_range(StringView text) // 3. Consume as many hex digits from text as possible. // then consume as many U+003F QUESTION MARK (?) code points as possible. + auto start_position = lexer.tell(); auto hex_digits = lexer.consume_while(is_ascii_hex_digit); auto question_marks = lexer.consume_while([](auto it) { return it == '?'; }); // If zero code points were consumed, or more than six code points were consumed, @@ -2226,7 +2227,7 @@ Optional Parser::parse_unicode_range(StringView text) dbgln_if(CSS_PARSER_DEBUG, "CSSParser: start value had {} digits/?s, expected between 1 and 6.", consumed_code_points); return {}; } - StringView start_value_code_points { hex_digits.characters_without_null_termination(), consumed_code_points }; + StringView start_value_code_points = text.substring_view(start_position, consumed_code_points); // If any U+003F QUESTION MARK (?) code points were consumed, then: if (question_marks.length() > 0) {