css: Fail animation shorthand parsing properly

When a number is not a nubmer, don't just crash, exit properly with an
error code.

See attached testcase for an example.
This commit is contained in:
Benjamin Otte 2014-07-30 18:45:15 +02:00
parent 5f5d3a9d82
commit d6e9997619
5 changed files with 10 additions and 0 deletions

View File

@ -722,6 +722,9 @@ parse_one_animation (GtkCssShorthandProperty *shorthand,
GTK_CSS_POSITIVE_ONLY
| (values[1] == NULL ? GTK_CSS_PARSE_NUMBER : 0)
| (values[3] == NULL ? GTK_CSS_PARSE_TIME : 0));
if (value == NULL)
return FALSE;
if (_gtk_css_number_value_get_unit (value) == GTK_CSS_NUMBER)
values[1] = value;
else if (values[2] == NULL)

View File

@ -30,6 +30,9 @@ clean-local:
rm $(builddir)/*.out.css || true
test_data = \
animation-crash-3.12.css \
animation-crash-3.12.errors \
animation-crash-3.12.ref.css \
animation-shorthand-crash.css \
animation-shorthand-crash.ref.css \
at-invalid-01.css \

View File

@ -0,0 +1,3 @@
* {
animation: 2gra;
}

View File

@ -0,0 +1 @@
animation-crash-3.12.css:2: error: GTK_CSS_PROVIDER_ERROR_SYNTAX