فهرست منبع

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 سال پیش
والد
کامیت
a02ee29af9
1فایلهای تغییر یافته به همراه1 افزوده شده و 1 حذف شده
  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())) {
         if (has_ignored_vendor_prefix(rule->at_rule_name())) {
             return {};
             return {};
         } else if (rule->at_rule_name().equals_ignoring_case("font-face"sv)) {
         } 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.");
                 dbgln_if(CSS_PARSER_DEBUG, "@font-face rule is malformed.");
                 return {};
                 return {};
             }
             }