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

Frediano Ziglio fziglio at redhat.com
Wed Feb 28 17:48:33 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>

Acked-by: Frediano Ziglio <fziglio at redhat.com>

I honestly don't think a single bit of the object
will change ;-)

I would be more worried about a scancode < 0.

> ---
>  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) {

Frediano


More information about the Spice-devel mailing list