From d2e7ff06d79fba4b2d965a0e55de075c81c4e43e Mon Sep 17 00:00:00 2001 From: Victor Toso Date: Tue, 25 Oct 2016 15:13:54 +0200 Subject: [PATCH] Fix crash due clipboard failure with text conversion Resolves: rhbz#1384676 --- ...lipboard-Fix-crash-by-handling-error.patch | 44 +++++++++++++++++++ spice-gtk.spec | 7 ++- 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 0001-clipboard-Fix-crash-by-handling-error.patch diff --git a/0001-clipboard-Fix-crash-by-handling-error.patch b/0001-clipboard-Fix-crash-by-handling-error.patch new file mode 100644 index 0000000..1009d5d --- /dev/null +++ b/0001-clipboard-Fix-crash-by-handling-error.patch @@ -0,0 +1,44 @@ +From 68c2d656e3f3d9c6d2027ae8eacf3064a8b88efa Mon Sep 17 00:00:00 2001 +From: Victor Toso +Date: Fri, 14 Oct 2016 18:12:01 +0200 +Subject: [PATCH] clipboard: Fix crash by handling error + +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 +Acked-by: Pavel Grunt +(cherry picked from commit 03c016bea939ee4a26e90d80fa1012a993a8ea47) +--- + 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..3e0ec74 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"); ++ return; ++ } ++ + g_return_if_fail(SPICE_IS_GTK_SESSION(self)); + + selection = get_selection_from_clipboard(self->priv, clipboard); +-- +2.9.3 + diff --git a/spice-gtk.spec b/spice-gtk.spec index 0c8f90a..b85dc28 100644 --- a/spice-gtk.spec +++ b/spice-gtk.spec @@ -2,7 +2,7 @@ Name: spice-gtk Version: 0.33 -Release: 1%{?dist} +Release: 2%{?dist} Summary: A GTK+ widget for SPICE clients Group: System Environment/Libraries @@ -10,6 +10,7 @@ License: LGPLv2+ URL: http://spice-space.org/page/Spice-Gtk #VCS: git:git://anongit.freedesktop.org/spice/spice-gtk Source0: http://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.bz2 +Patch1: 0001-clipboard-Fix-crash-by-handling-error.patch BuildRequires: intltool BuildRequires: usbredir-devel >= 0.5.2 @@ -184,6 +185,10 @@ rm -f %{buildroot}%{_libdir}/*.la %{_bindir}/spicy-stats %changelog +* Tue Oct 25 2016 Victor Toso - 0.33-2 +- Fix crash due clipboard failure with text conversion + Resolves: rhbz#1384676 + * Fri Oct 07 2016 Marc-André Lureau - 0.33-1 - Update to new 0.33 upstream release