[Spice-devel] [spice-gtk v2] clipboard: Fix crash by handling error

Victor Toso lists at victortoso.com
Mon Oct 17 13:09:40 UTC 2016


Hi,

On Mon, Oct 17, 2016 at 02:38:29PM +0200, Pavel Grunt wrote:
> Hey,
> 
> On Sat, 2016-10-15 at 14:15 +0200, victortoso at redhat.com wrote:
> > From: Victor Toso <me at victortoso.com>
> > 
> > As manual states below, text could be NULL for different reasons and
> > we should handle that. I've included a debug message to help
> > identifying possible regressions from wayland's clipboard.
> > 
> > This crash is a regression from 7b0de6217670e0f668aff2949f
> > 
> >  "The text parameter to callback will contain the resulting text if
> >  the request succeeded, or NULL if it failed. This could happen for
> >  various reasons, in particular if the clipboard was empty or if the
> >  contents of the clipboard could not be converted into text form."
> > 
> > Resolves: rhbz#1384676
> > 
> > Signed-off-by: Victor Toso <victortoso at redhat.com>
> > ---
> >  src/spice-gtk-session.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/src/spice-gtk-session.c b/src/spice-gtk-session.c
> > index 3ff4e9a..c08483c 100644
> > --- a/src/spice-gtk-session.c
> > +++ b/src/spice-gtk-session.c
> > @@ -945,6 +945,11 @@ static void
> > clipboard_received_text_cb(GtkClipboard *clipboard,
> >      if (self == NULL)
> >          return;
> >  
> > +    if (text == NULL) {
> > +        SPICE_DEBUG ("Failed to retrieve clipboard text");
> an extra space        ^

Fixed

> > +        return;
> > +    }
> > +
> >      g_return_if_fail(SPICE_IS_GTK_SESSION(self));
> >  
> >      selection = get_selection_from_clipboard(self->priv,
> > clipboard);
> 
> 
> Acked-by: Pavel Grunt <pgrunt at redhat.com>

Thanks, pushed as
03c016bea939ee4a26e90d80fa1012a993a8ea47
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20161017/54bbf7ea/attachment.sig>


More information about the Spice-devel mailing list