summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2009-06-27 17:25:00 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2009-06-27 17:25:00 +0000
commit63b5966f3fc337ed7b6e909b8127928b52a84589 (patch)
tree4e7c869429e5b6d2e4dc56d5d3ff63f6be7e25e7
parent4152000f05570815979706d046973c8b7f4f411d (diff)
downloadlibcss-63b5966f3fc337ed7b6e909b8127928b52a84589.tar.gz
libcss-63b5966f3fc337ed7b6e909b8127928b52a84589.tar.bz2
Fix font shorthand parser to reject spurious instances of inherit
svn path=/trunk/libcss/; revision=8069
-rw-r--r--src/parse/properties/font.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/parse/properties/font.c b/src/parse/properties/font.c
index 1d16d5a..4c8d120 100644
--- a/src/parse/properties/font.c
+++ b/src/parse/properties/font.c
@@ -89,6 +89,14 @@ css_error parse_font(css_language *c,
prev_ctx = *ctx;
error = CSS_OK;
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && token->type == CSS_TOKEN_IDENT &&
+ token->ilower == c->strings[INHERIT]) {
+ error = CSS_INVALID;
+ goto cleanup;
+ }
+
if (style == NULL &&
(error = parse_font_style(c, vector,
ctx, &style)) == CSS_OK) {
@@ -114,6 +122,14 @@ css_error parse_font(css_language *c,
consumeWhitespace(vector, ctx);
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && token->type == CSS_TOKEN_IDENT &&
+ token->ilower == c->strings[INHERIT]) {
+ error = CSS_INVALID;
+ goto cleanup;
+ }
+
/* Now expect a font-size */
error = parse_font_size(c, vector, ctx, &size);
if (error != CSS_OK)
@@ -128,6 +144,14 @@ css_error parse_font(css_language *c,
consumeWhitespace(vector, ctx);
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && token->type == CSS_TOKEN_IDENT &&
+ token->ilower == c->strings[INHERIT]) {
+ error = CSS_INVALID;
+ goto cleanup;
+ }
+
error = parse_line_height(c, vector, ctx, &line_height);
if (error != CSS_OK)
goto cleanup;
@@ -135,6 +159,14 @@ css_error parse_font(css_language *c,
consumeWhitespace(vector, ctx);
+ /* Ensure that we're not about to parse another inherit */
+ token = parserutils_vector_peek(vector, *ctx);
+ if (token != NULL && token->type == CSS_TOKEN_IDENT &&
+ token->ilower == c->strings[INHERIT]) {
+ error = CSS_INVALID;
+ goto cleanup;
+ }
+
/* Now expect a font-family */
error = parse_font_family(c, vector, ctx, &family);
if (error != CSS_OK)