[evolution-patches] 43395 soup crash



The soup-message.c part is the actual bug. The soup-queue.c part is
something valgrind noticed.

The soup-openssl.c part is something I fixed while trying to debug a
further non-crasher bug which I eventually gave up on trying to fix.
Amusingly, fixing the SEGV does not actually change soup's behavior in
any user-visible way in this case.


Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/libsoup/ChangeLog,v
retrieving revision 1.305
diff -u -r1.305 ChangeLog
--- ChangeLog	9 May 2003 16:34:43 -0000	1.305
+++ ChangeLog	20 May 2003 21:35:55 -0000
@@ -1,3 +1,16 @@
+2003-05-20  Dan Winship  <danw ximian com>
+
+	* libsoup/soup-message.c (soup_message_requeue): Clear the
+	write_tag as well so we don't double-cancel it. #43395.
+
+	* libsoup/soup-queue.c (soup_queue_error_cb): The connection might
+	be destroyed by the end of the func, so we have to call
+	soup_connection_set_used at the beginning.
+
+	* libsoup/soup-openssl.c (soup_openssl_read, soup_openssl_write):
+	Call g_set_error() so that we don't SEGV immediately after
+	returning G_IO_STATUS_ERROR.
+
 2003-05-08  Joe Shaw  <joe ximian com>
 
 	* configure.in: Bump version to 1.99.21
Index: libsoup/soup-message.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-message.c,v
retrieving revision 1.56
diff -u -r1.56 soup-message.c
--- libsoup/soup-message.c	9 May 2003 15:25:31 -0000	1.56
+++ libsoup/soup-message.c	20 May 2003 21:35:56 -0000
@@ -576,6 +576,11 @@
 						  requeue_read_error,
 						  req);
 		req->priv->read_tag = 0;
+
+		if (req->priv->write_tag) {
+			soup_transfer_write_cancel (req->priv->write_tag);
+			req->priv->write_tag = 0;
+		}
 	} else
 		soup_queue_message (req, 
 				    req->priv->callback, 
Index: libsoup/soup-openssl.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-openssl.c,v
retrieving revision 1.15
diff -u -r1.15 soup-openssl.c
--- libsoup/soup-openssl.c	18 Mar 2003 15:41:14 -0000	1.15
+++ libsoup/soup-openssl.c	20 May 2003 21:35:56 -0000
@@ -60,16 +60,13 @@
 		if (SSL_get_error (chan->ssl, result) == SSL_ERROR_WANT_READ)
 		  	return G_IO_STATUS_AGAIN;
 		switch (errno) {
-		case EINVAL:
-#if 0
-			return G_IO_ERROR_INVAL;
-#else
-			return G_IO_STATUS_ERROR;
-#endif
 		case EAGAIN:
 		case EINTR:
 			return G_IO_STATUS_AGAIN;
 		default:
+			g_set_error (err, G_IO_CHANNEL_ERROR,
+				     g_io_channel_error_from_errno (errno),
+				     g_strerror (errno));
 			return G_IO_STATUS_ERROR;
 		}
 	} else {
@@ -95,16 +92,13 @@
 		if (SSL_get_error (chan->ssl, result) == SSL_ERROR_WANT_WRITE)
 			return G_IO_STATUS_AGAIN;
 		switch (errno) {
-		case EINVAL:
-#if 0
-			return G_IO_ERROR_INVAL;
-#else
-			return G_IO_STATUS_ERROR;
-#endif
 		case EAGAIN:
 		case EINTR:
 			return G_IO_STATUS_AGAIN;
 		default:
+			g_set_error (err, G_IO_CHANNEL_ERROR,
+				     g_io_channel_error_from_errno (errno),
+				     g_strerror (errno));
 			return G_IO_STATUS_ERROR;
 		}
 	} else {
Index: libsoup/soup-queue.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-queue.c,v
retrieving revision 1.82
diff -u -r1.82 soup-queue.c
--- libsoup/soup-queue.c	9 May 2003 16:34:44 -0000	1.82
+++ libsoup/soup-queue.c	20 May 2003 21:35:56 -0000
@@ -58,7 +58,10 @@
 soup_queue_error_cb (gboolean body_started, gpointer user_data)
 {
 	SoupMessage *req = user_data;
+	gboolean conn_is_new;
 
+	conn_is_new = soup_connection_is_new (req->connection);
+	soup_connection_set_used (req->connection);
 	soup_connection_set_keep_alive (req->connection, FALSE);
 
 	switch (req->status) {
@@ -90,7 +93,7 @@
 					req->priv->retries++;
 					soup_message_requeue (req);
 				}
-			} else if (soup_connection_is_new (req->connection)) {
+			} else if (conn_is_new) {
 				soup_message_set_error (
 					req,
 					SOUP_ERROR_CANT_CONNECT);
@@ -112,9 +115,6 @@
 		soup_message_issue_callback (req);
 		break;
 	}
-
-	if (req->connection)
-		soup_connection_set_used (req->connection);
 }
 
 static SoupTransferDone


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]