css: Don't infloop when parsing broken borders

There was an infinite loop when parsing invalid text after having parsed
a color in the border shorthand. See attached testcase for an example.
This commit is contained in:
Benjamin Otte 2014-07-30 18:23:20 +02:00
parent 83c9fe109e
commit 5f5d3a9d82
5 changed files with 14 additions and 0 deletions

View File

@ -353,6 +353,13 @@ parse_border_side (GtkCssShorthandProperty *shorthand,
if (values[2] == NULL)
return FALSE;
}
else
{
/* We parsed and there's still stuff left?
* Pretend we didn't notice and let the normal code produce
* a 'junk at end of value' error */
break;
}
}
while (!value_is_done_parsing (parser));

View File

@ -178,6 +178,9 @@ test_data = \
border.ref.css \
border-color-currentcolor.css \
border-color-currentcolor.ref.css \
border-infloop-3.12.css \
border-infloop-3.12.errors \
border-infloop-3.12.ref.css \
border-radius.css \
border-radius.errors \
border-radius.ref.css \

View File

@ -0,0 +1,3 @@
* {
border-bottom: tomato dot;
}

View File

@ -0,0 +1 @@
border-infloop-3.12.css:2: error: GTK_CSS_PROVIDER_ERROR_SYNTAX