mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 15:14:17 +00:00
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
(cherry picked from commit a76f515569
)
This commit is contained in:
parent
82b2558e46
commit
a5b1a86ab7
@ -312,7 +312,13 @@ parse_image (GtkCssParser *parser,
|
|||||||
GtkCssImage **image = option_data;
|
GtkCssImage **image = option_data;
|
||||||
|
|
||||||
if (_gtk_css_image_can_parse (parser))
|
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))
|
else if (gtk_css_color_value_can_parse (parser))
|
||||||
{
|
{
|
||||||
GtkCssValue *color;
|
GtkCssValue *color;
|
||||||
@ -322,11 +328,11 @@ parse_image (GtkCssParser *parser,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*image = _gtk_css_image_fallback_new_for_color (color);
|
*image = _gtk_css_image_fallback_new_for_color (color);
|
||||||
}
|
|
||||||
else
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static guint
|
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.css',
|
||||||
'comment-detection.ref.css',
|
'comment-detection.ref.css',
|
||||||
'cross-fade-basic.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.css',
|
||||||
'css-21-malformed-declarations.errors',
|
'css-21-malformed-declarations.errors',
|
||||||
'css-21-malformed-declarations.ref.css',
|
'css-21-malformed-declarations.ref.css',
|
||||||
|
Loading…
Reference in New Issue
Block a user