Selaa lähdekoodia

LibWeb/CSS: Check for NULL block statement when parsing font-face rule

This prevents font-face rules without a block statement from crashing
LibWeb during CSS parsing.

The issue was discovered by Lubrsi during CSS parser fuzzing. :)
Fixes #14141.
CodeforEvolution 3 vuotta sitten
vanhempi
commit
a02ee29af9
1 muutettua tiedostoa jossa 1 lisäystä ja 1 poistoa
  1. 1 1
      Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

@@ -2361,7 +2361,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<Rule> rule)
         if (has_ignored_vendor_prefix(rule->at_rule_name())) {
             return {};
         } else if (rule->at_rule_name().equals_ignoring_case("font-face"sv)) {
-            if (rule->prelude().is_empty() || !rule->block()->is_curly()) {
+            if (rule->prelude().is_empty() || !rule->block() || !rule->block()->is_curly()) {
                 dbgln_if(CSS_PARSER_DEBUG, "@font-face rule is malformed.");
                 return {};
             }