From 4f94ea2ed4b392eab596fdeb9f69e097e5c4d6b8 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Thu, 25 Jun 2009 11:44:43 +0000 Subject: Any declaration with non-whitespace tokens unconsumed after parsing the property value and potential !important is invalid. svn path=/trunk/libcss/; revision=7970 --- src/parse/language.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'src/parse/language.c') diff --git a/src/parse/language.c b/src/parse/language.c index 37edad8..c031bd4 100644 --- a/src/parse/language.c +++ b/src/parse/language.c @@ -1029,6 +1029,7 @@ css_error parseProperty(css_language *c, const css_token *property, int i = 0; uint8_t flags = 0; css_style *style = NULL; + const css_token *token; /* Find property index */ /** \todo improve on this linear search */ @@ -1050,13 +1051,22 @@ css_error parseProperty(css_language *c, const css_token *property, assert (style != NULL); - /* Determine if this is important or not */ + /* Determine if this declaration is important or not */ error = parse_important(c, vector, ctx, &flags); if (error != CSS_OK) { css_stylesheet_style_destroy(c->sheet, style); return error; } + /* Ensure that we've exhausted all the input */ + consumeWhitespace(vector, ctx); + token = parserutils_vector_iterate(vector, ctx); + if (token != NULL) { + /* Trailing junk, so discard declaration */ + css_stylesheet_style_destroy(c->sheet, style); + return CSS_INVALID; + } + /* If it's important, then mark the style appropriately */ if (flags != 0) make_style_important(style); -- cgit v1.2.3