summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-10-09 18:42:08 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-10-09 18:42:08 +0200
commit59795aab41728b6ffda903781b9063f4dc907490 (patch)
tree3dd5066410cd2b1e180346ab833c32388b0d5b87
parent2ac190dc5fd2d22ced31c18fc123c99ee9e7577c (diff)
downloadserenity-59795aab41728b6ffda903781b9063f4dc907490.zip
LibHTML: Handle CSS declarations that don't end in ';'
-rw-r--r--Libraries/LibHTML/Parser/CSSParser.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Libraries/LibHTML/Parser/CSSParser.cpp b/Libraries/LibHTML/Parser/CSSParser.cpp
index 4166177b78..17957c3b42 100644
--- a/Libraries/LibHTML/Parser/CSSParser.cpp
+++ b/Libraries/LibHTML/Parser/CSSParser.cpp
@@ -114,12 +114,14 @@ public:
char consume_specific(char ch)
{
PARSE_ASSERT(peek() == ch);
+ PARSE_ASSERT(index < css.length());
++index;
return ch;
}
char consume_one()
{
+ PARSE_ASSERT(index < css.length());
return css[index++];
};
@@ -237,12 +239,12 @@ public:
bool is_valid_property_name_char(char ch) const
{
- return !isspace(ch) && ch != ':';
+ return ch && !isspace(ch) && ch != ':';
}
bool is_valid_property_value_char(char ch) const
{
- return ch != '!' && ch != ';';
+ return ch && ch != '!' && ch != ';';
}
Optional<StyleProperty> parse_property()
@@ -280,7 +282,7 @@ public:
consume_whitespace();
is_important = true;
}
- if (peek() != '}')
+ if (peek() && peek() != '}')
consume_specific(';');
return StyleProperty { parse_css_property_id(property_name), parse_css_value(property_value), is_important };