srctree

Robin Linden parent 06e403a2 187e8bb7
css: Don't crash on multiple keyframe at-rules in a row

inlinesplit
css/parser.h added: 19, removed: 6, total 13
@@ -60,10 +60,7 @@ public:
 
consume_char(); // }
skip_whitespace_and_comments();
 
if (is_eof()) {
break;
}
continue;
}
 
rules.push_back(parse_rule());
 
css/parser_test.cpp added: 19, removed: 6, total 13
@@ -657,5 +657,21 @@ int main() {
expect(rules.empty());
});
 
etest::test("parser: several @keyframes in a row doesn't crash the parser", [] {
auto css = R"(
@keyframes toast-spinner {
from { transform: rotate(0deg) }
to { transform: rotate(360deg) }
}
@keyframes toast-spinner {
from { transform: rotate(0deg) }
to { transform: rotate(360deg) }
})"sv;
 
// No rules produced (yet!) since this isn't handled aside from not crashing.
auto rules = css::parse(css);
expect(rules.empty());
});
 
return etest::run_all_tests();
}