forked from AuroraMiddleware/gtk
cssimagecrossfade: Don't abort() when failing to parse image
The code wasn't checking if parsing an image failed and just returning success. Testcase from bug is attached. Fixes #4101
This commit is contained in:
parent
a663b8c313
commit
a76f515569
@ -312,7 +312,13 @@ parse_image (GtkCssParser *parser,
|
||||
GtkCssImage **image = option_data;
|
||||
|
||||
if (_gtk_css_image_can_parse (parser))
|
||||
*image = _gtk_css_image_new_parse (parser);
|
||||
{
|
||||
*image = _gtk_css_image_new_parse (parser);
|
||||
if (*image == NULL)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else if (gtk_css_color_value_can_parse (parser))
|
||||
{
|
||||
GtkCssValue *color;
|
||||
@ -322,11 +328,11 @@ parse_image (GtkCssParser *parser,
|
||||
return FALSE;
|
||||
|
||||
*image = _gtk_css_image_fallback_new_for_color (color);
|
||||
}
|
||||
else
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static guint
|
||||
|
3
testsuite/css/parser/cross-fade-crash-4101.css
Normal file
3
testsuite/css/parser/cross-fade-crash-4101.css
Normal file
@ -0,0 +1,3 @@
|
||||
a {
|
||||
background: cross-fade(8% -gtk-icontheme("system-run-symbolic"), image());
|
||||
}
|
1
testsuite/css/parser/cross-fade-crash-4101.errors
Normal file
1
testsuite/css/parser/cross-fade-crash-4101.errors
Normal file
@ -0,0 +1 @@
|
||||
cross-fade-crash-4101.css:2:74-75: error: GTK_CSS_PARSER_ERROR_SYNTAX
|
0
testsuite/css/parser/cross-fade-crash-4101.ref.css
Normal file
0
testsuite/css/parser/cross-fade-crash-4101.ref.css
Normal file
@ -212,6 +212,9 @@ test_data = [
|
||||
'comment-detection.css',
|
||||
'comment-detection.ref.css',
|
||||
'cross-fade-basic.css',
|
||||
'cross-fade-crash-4101.css',
|
||||
'cross-fade-crash-4101.errors',
|
||||
'cross-fade-crash-4101.ref.css',
|
||||
'css-21-malformed-declarations.css',
|
||||
'css-21-malformed-declarations.errors',
|
||||
'css-21-malformed-declarations.ref.css',
|
||||
|
Loading…
Reference in New Issue
Block a user