summaryrefslogtreecommitdiff
path: root/src/parse/language.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-06-25 11:44:43 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-06-25 11:44:43 +0000
commit4f94ea2ed4b392eab596fdeb9f69e097e5c4d6b8 (patch)
tree1a5236c43688242f0bdf7e844babd34b1bd7a160 /src/parse/language.c
parent0668988e571b816ee0212956a1412a329a610ba7 (diff)
downloadlibcss-4f94ea2ed4b392eab596fdeb9f69e097e5c4d6b8.tar.gz
libcss-4f94ea2ed4b392eab596fdeb9f69e097e5c4d6b8.tar.bz2
Any declaration with non-whitespace tokens unconsumed after parsing the property value and potential !important is invalid.
svn path=/trunk/libcss/; revision=7970
Diffstat (limited to 'src/parse/language.c')
-rw-r--r--src/parse/language.c12
1 files changed, 11 insertions, 1 deletions
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);