[Spice-devel] [spice-gtk v1] spice-widget: Avoid promoting signed 1 on shift

Victor Toso victortoso at redhat.com
Wed Feb 28 17:39:46 UTC 2018


From: Victor Toso <me at victortoso.com>

Address sanitizer runtime error:
 > spice-widget.c:1433:12: runtime error: left shift of
 > 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Victor Toso <victortoso at redhat.com>
---
 src/spice-widget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/spice-widget.c b/src/spice-widget.c
index 316043a..1e7add4 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1430,7 +1430,7 @@ static void send_key(SpiceDisplay *display, int scancode, SendKeyType type, gboo
 
     i = scancode / 32;
     b = scancode % 32;
-    m = (1 << b);
+    m = (1u << b);
     g_return_if_fail(i < SPICE_N_ELEMENTS(d->key_state));
 
     switch (type) {
-- 
2.16.2



More information about the Spice-devel mailing list