[libsoup/f17] Fix a crash in SoupSessionSync (#750036)

Dan Winship danw at fedoraproject.org
Thu Jul 19 13:03:29 UTC 2012


commit e6552c39cdd99410bfdb2c5ee914ff9fe3820812
Author: Dan Winship <danw at gnome.org>
Date:   Thu Jul 19 09:01:45 2012 -0400

    Fix a crash in SoupSessionSync (#750036)

 libsoup-sync-disconnect.patch |   39 +++++++++++++++++++++++++++++++++++++++
 libsoup.spec                  |    8 +++++++-
 2 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/libsoup-sync-disconnect.patch b/libsoup-sync-disconnect.patch
new file mode 100644
index 0000000..58d13f3
--- /dev/null
+++ b/libsoup-sync-disconnect.patch
@@ -0,0 +1,39 @@
+From d0d534568c97271e03a0e9f9c16a0966fb50b97a Mon Sep 17 00:00:00 2001
+From: Dan Winship <danw at gnome.org>
+Date: Thu, 19 Jul 2012 08:49:55 -0400
+Subject: [PATCH] SoupSocket: don't emit "readable" on disconnect for blocking
+ sockets
+
+"readable" and "writable" are only supposed to be emitted for
+non-blocking sockets, but we were emitting "readable" on disconnect
+for all sockets.
+
+In libsoup 2.38 and earlier, this could cause a crash if a message in
+a SoupSessionSync failed at certain points, since the code wasn't
+expecting to end up in io_read(). The current code no longer has this
+problem (since soup-message-io no longer uses the SoupSocket signals),
+but other external users of SoupSocket might.
+---
+ libsoup/soup-socket.c |    6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/libsoup/soup-socket.c b/libsoup/soup-socket.c
+index 2ac359d..5a88907 100644
+--- a/libsoup/soup-socket.c
++++ b/libsoup/soup-socket.c
+@@ -1242,8 +1242,10 @@ soup_socket_disconnect (SoupSocket *sock)
+ 	 */
+ 	g_object_ref (sock);
+ 
+-	/* Give all readers a chance to notice the connection close */
+-	g_signal_emit (sock, signals[READABLE], 0);
++	if (priv->non_blocking) {
++		/* Give all readers a chance to notice the connection close */
++		g_signal_emit (sock, signals[READABLE], 0);
++	}
+ 
+ 	/* FIXME: can't disconnect until all data is read */
+ 
+-- 
+1.7.10.4
+
diff --git a/libsoup.spec b/libsoup.spec
index acdee59..3cf1ab8 100644
--- a/libsoup.spec
+++ b/libsoup.spec
@@ -4,7 +4,7 @@
 
 Name: libsoup
 Version: 2.38.1
-Release: 1%{?dist}
+Release: 2%{?dist}
 License: LGPLv2
 Group: Development/Libraries
 Summary: Soup, an HTTP library implementation
@@ -23,6 +23,8 @@ BuildRequires: sqlite-devel
 BuildRequires: gnome-keyring-devel
 BuildRequires: libgnome-keyring-devel
 
+Patch0: libsoup-sync-disconnect.patch
+
 %description
 Libsoup is an HTTP library implementation in C. It was originally part
 of a SOAP (Simple Object Access Protocol) implementation called Soup, but
@@ -48,6 +50,7 @@ you to develop applications that use the libsoup library.
 
 %prep
 %setup -q
+%patch0 -p1 -b .sync-disconnect
 
 %build
 %configure
@@ -81,6 +84,9 @@ rm -f $RPM_BUILD_ROOT/%{_libdir}/*.a
 %{_datadir}/gtk-doc/html/%{name}-2.4
 
 %changelog
+* Thu Jul 19 2012 Dan Winship <danw at redhat.com> - 2.38.1-2
+- Fix a crash in SoupSessionSync (#750036)
+
 * Tue Apr 17 2012 Kalev Lember <kalevlember at gmail.com> - 2.38.1-1
 - Update to 2.38.1
 


More information about the scm-commits mailing list