74 lines
2.8 KiB
Diff
74 lines
2.8 KiB
Diff
From d1255aae8dd0486dd78f782ad8ed2a714245ea7a Mon Sep 17 00:00:00 2001
|
|
From: Michael Catanzaro <mcatanzaro@redhat.com>
|
|
Date: Wed, 21 May 2025 10:33:36 -0500
|
|
Subject: [PATCH] Upstream patches for CVE-2024-52532
|
|
|
|
https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/410
|
|
https://gitlab.gnome.org/GNOME/libsoup/-/merge_requests/414
|
|
---
|
|
libsoup/soup-websocket-connection.c | 4 ++--
|
|
tests/websocket-test.c | 8 ++++++--
|
|
2 files changed, 8 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/libsoup/soup-websocket-connection.c b/libsoup/soup-websocket-connection.c
|
|
index a4095e1c..36524d04 100644
|
|
--- a/libsoup/soup-websocket-connection.c
|
|
+++ b/libsoup/soup-websocket-connection.c
|
|
@@ -1140,9 +1140,9 @@ soup_websocket_connection_read (SoupWebsocketConnection *self)
|
|
}
|
|
|
|
pv->incoming->len = len + count;
|
|
- } while (count > 0);
|
|
+ process_incoming (self);
|
|
+ } while (count > 0 && !pv->close_sent && !pv->io_closing);
|
|
|
|
- process_incoming (self);
|
|
|
|
if (end) {
|
|
if (!pv->close_sent || !pv->close_received) {
|
|
diff --git a/tests/websocket-test.c b/tests/websocket-test.c
|
|
index 5e40cf36..93e9b14a 100644
|
|
--- a/tests/websocket-test.c
|
|
+++ b/tests/websocket-test.c
|
|
@@ -1300,8 +1300,9 @@ test_receive_invalid_encode_length_16 (Test *test,
|
|
GError *error = NULL;
|
|
InvalidEncodeLengthTest context = { test, NULL };
|
|
guint i;
|
|
+ guint error_id;
|
|
|
|
- g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error);
|
|
+ error_id = g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error);
|
|
g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received);
|
|
|
|
/* We use 126(~) as payload length with 125 extended length */
|
|
@@ -1314,6 +1315,7 @@ test_receive_invalid_encode_length_16 (Test *test,
|
|
WAIT_UNTIL (error != NULL || received != NULL);
|
|
g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR);
|
|
g_clear_error (&error);
|
|
+ g_signal_handler_disconnect (test->client, error_id);
|
|
g_assert_null (received);
|
|
|
|
g_thread_join (thread);
|
|
@@ -1331,8 +1333,9 @@ test_receive_invalid_encode_length_64 (Test *test,
|
|
GError *error = NULL;
|
|
InvalidEncodeLengthTest context = { test, NULL };
|
|
guint i;
|
|
+ guint error_id;
|
|
|
|
- g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error);
|
|
+ error_id = g_signal_connect (test->client, "error", G_CALLBACK (on_error_copy), &error);
|
|
g_signal_connect (test->client, "message", G_CALLBACK (on_binary_message), &received);
|
|
|
|
/* We use 127(\x7f) as payload length with 65535 extended length */
|
|
@@ -1345,6 +1348,7 @@ test_receive_invalid_encode_length_64 (Test *test,
|
|
WAIT_UNTIL (error != NULL || received != NULL);
|
|
g_assert_error (error, SOUP_WEBSOCKET_ERROR, SOUP_WEBSOCKET_CLOSE_PROTOCOL_ERROR);
|
|
g_clear_error (&error);
|
|
+ g_signal_handler_disconnect (test->client, error_id);
|
|
g_assert_null (received);
|
|
|
|
g_thread_join (thread);
|
|
--
|
|
2.49.0
|
|
|