nodeparser: Fix SEGV in shadows parsing code

Testcase included

The code was writing invalid memory, so this might not have always
crashed, but I did my best to write the test so it causes a SEGV.

Also included is a fix for the testsuite where the expected result was
wrong.
This commit is contained in:
Benjamin Otte
2023-12-30 02:39:31 +01:00
parent e9d2f832a1
commit da5de1ba99
4 changed files with 15 additions and 2 deletions

View File

@@ -711,7 +711,7 @@ parse_shadows (GtkCssParser *parser,
static void
clear_shadows (gpointer inout_shadows)
{
g_array_set_size (*(GArray **) inout_shadows, 0);
g_array_set_size (inout_shadows, 0);
}
static const struct

View File

@@ -7,3 +7,5 @@
<data>:3:11-13: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE
<data>:3:13-14: error: GTK_CSS_PARSER_ERROR_SYNTAX
<data>:3:13-14: error: GTK_CSS_PARSER_ERROR_UNKNOWN_VALUE
<data>:7:22-24: error: GTK_CSS_PARSER_ERROR_SYNTAX
<data>:7:2-8:1: error: GTK_CSS_PARSER_WARNING_SYNTAX

View File

@@ -2,3 +2,7 @@ shadow {
shadows: 22;
shadows: 22;
}
shadow {
shadows: blue 50 50 hi:
}

View File

@@ -1,5 +1,12 @@
shadow {
shadows: rgb(0,0,0) 22 0, rgb(0,0,0) 22 0;
shadows: rgb(0,0,0) 22 0;
child: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);
}
}
shadow {
shadows: rgb(0,0,0) 1 1;
child: color {
bounds: 0 0 50 50;
color: rgb(255,0,204);