From 63b5966f3fc337ed7b6e909b8127928b52a84589 Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Sat, 27 Jun 2009 17:25:00 +0000 Subject: Fix font shorthand parser to reject spurious instances of inherit svn path=/trunk/libcss/; revision=8069 --- src/parse/properties/font.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/parse') 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) -- cgit v1.2.3