[gtk+] cssselector: Don't invoke undefined behavior
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssselector: Don't invoke undefined behavior
- Date: Fri, 26 Feb 2016 20:52:49 +0000 (UTC)
commit 6108c646c57c6c489225f5e5e6484ac282c07bdf
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Feb 26 14:48:21 2016 -0500
cssselector: Don't invoke undefined behavior
Avoid undefined behavior in the calculation of some
hash values. Found by gcc's undefined behavior sanitizer.
gtk/gtkcssselector.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcssselector.c b/gtk/gtkcssselector.c
index f0e91b2..9309de5 100644
--- a/gtk/gtkcssselector.c
+++ b/gtk/gtkcssselector.c
@@ -842,7 +842,7 @@ match_pseudoclass_position (const GtkCssSelector *selector,
static guint
hash_pseudoclass_position (const GtkCssSelector *a)
{
- return (((a->position.type << POSITION_NUMBER_BITS) | a->position.a) << POSITION_NUMBER_BITS) |
a->position.b;
+ return (guint)(((((gulong)a->position.type) << POSITION_NUMBER_BITS) | a->position.a) <<
POSITION_NUMBER_BITS) | a->position.b;
}
static int
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]