[Spice-devel] [spice-gtk 2/2] cursor: don't access unitialized data when logging

Alon Levy alevy at redhat.com
Thu Sep 13 13:51:55 PDT 2012


> SpiceCursor::header is only valid when SPICE_CURSOR_FLAGS_NONE is
> not set in SpiceCursor::flags, so don't try to log info about
> the header before we have tested this flag.

ACK both.

> ---
>  gtk/channel-cursor.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/gtk/channel-cursor.c b/gtk/channel-cursor.c
> index 45e78c6..99e7a48 100644
> --- a/gtk/channel-cursor.c
> +++ b/gtk/channel-cursor.c
> @@ -337,13 +337,15 @@ static display_cursor *set_cursor(SpiceChannel
> *channel, SpiceCursor *scursor)
>      guint8 *rgba;
>      guint8 val;
>  
> -    CHANNEL_DEBUG(channel, "%s: type %d, %" PRIx64 ", %dx%d, flags
> %d, size %d",
> -            __FUNCTION__, hdr->type, hdr->unique, hdr->width,
> hdr->height,
> -            scursor->flags, scursor->data_size);
> +    CHANNEL_DEBUG(channel, "%s: flags %d, size %d", __FUNCTION__,
> +                  scursor->flags, scursor->data_size);
>  
>      if (scursor->flags & SPICE_CURSOR_FLAGS_NONE)
>          return NULL;
>  
> +    CHANNEL_DEBUG(channel, "%s: type %d, %" PRIx64 ", %dx%d",
> __FUNCTION__,
> +                  hdr->type, hdr->unique, hdr->width, hdr->height);
> +
>      if (scursor->flags & SPICE_CURSOR_FLAGS_FROM_CACHE) {
>          item = cache_find(&c->cursors, hdr->unique);
>          g_return_val_if_fail(item != NULL, NULL);
> --
> 1.7.11.4
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 


More information about the Spice-devel mailing list