gtkcssnodedeclaration: Avoid signed left shift by 31 bits
Left-shifting a signed 32-bit integer by 31 bits (such that the value overflows into the sign bit) is undefined behaviour. Use an unsigned integer instead. Detected by running a subset of the test suite with -Dsanitize=address,undefined on x86_64. Signed-off-by: Simon McVittie <smcv@debian.org>
This commit is contained in:
@@ -446,9 +446,9 @@ gtk_css_node_declaration_print (const GtkCssNodeDeclaration *decl,
|
||||
|
||||
for (i = 0; i < sizeof (GtkStateFlags) * 8; i++)
|
||||
{
|
||||
if (decl->state & (1 << i))
|
||||
if (decl->state & (1u << i))
|
||||
{
|
||||
const char *name = gtk_css_pseudoclass_name (1 << i);
|
||||
const char *name = gtk_css_pseudoclass_name (1u << i);
|
||||
g_assert (name);
|
||||
g_string_append_c (string, ':');
|
||||
g_string_append (string, name);
|
||||
|
||||
Reference in New Issue
Block a user