Merge ~3v1n0/ubuntu/+source/glib2.0:ubuntu/bionic+gsubprocess-fix into ~ubuntu-desktop/ubuntu/+source/glib2.0:ubuntu/bionic

Proposed by Marco Trevisan (Treviño)
Status: Rejected
Rejected by: Iain Lane
Proposed branch: ~3v1n0/ubuntu/+source/glib2.0:ubuntu/bionic+gsubprocess-fix
Merge into: ~ubuntu-desktop/ubuntu/+source/glib2.0:ubuntu/bionic
Diff against target: 73 lines (+51/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/series (+1/-0)
debian/patches/subprocess-Fix-communicate_cancelled-signature.patch (+43/-0)
Reviewer Review Type Date Requested Status
Ubuntu Desktop Pending
Review via email: mp+354012@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Iain Lane (laney) wrote :

thanks for the great work! :)

this is going to be in 2.56.4 though, so we'll get it via that route

😼

Unmerged commits

d37138b... by Marco Trevisan (Treviño)

Finalise changelog

78c1b38... by Marco Trevisan (Treviño)

d/p/subprocess-Fix-communicate_cancelled-signature.patch

Fix crash on subprocess communicate cancellation

Fixes LP: #1789476

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index d5989ce..91afd50 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+glib2.0 (2.56.2-0ubuntu0.18.04.2) bionic; urgency=medium
7+
8+ * d/p/subprocess-Fix-communicate_cancelled-signature.patch:
9+ - Fix crash on subprocess communicate cancellation (LP: #1789476)
10+
11+ -- Marco Trevisan (Treviño) <marco@ubuntu.com> Wed, 29 Aug 2018 18:21:34 -0500
12+
13 glib2.0 (2.56.2-0ubuntu0.18.04.1) bionic; urgency=medium
14
15 * New upstream release (LP: #1789472, LP: #1764779)
16diff --git a/debian/patches/series b/debian/patches/series
17index 4f622de..2ffcbae 100644
18--- a/debian/patches/series
19+++ b/debian/patches/series
20@@ -17,3 +17,4 @@ exp_git_default_per_desktop1.patch
21 exp_git_default_per_desktop2.patch
22 exp_git_default_per_desktop3.patch
23 exp_git_default_per_desktop4.patch
24+subprocess-Fix-communicate_cancelled-signature.patch
25diff --git a/debian/patches/subprocess-Fix-communicate_cancelled-signature.patch b/debian/patches/subprocess-Fix-communicate_cancelled-signature.patch
26new file mode 100644
27index 0000000..1c6100e
28--- /dev/null
29+++ b/debian/patches/subprocess-Fix-communicate_cancelled-signature.patch
30@@ -0,0 +1,43 @@
31+From: =?utf-8?b?Ik1hcmNvIFRyZXZpc2FuIChUcmV2acOxbyki?= <mail@3v1n0.net>
32+Date: Fri, 24 Aug 2018 06:05:03 +0200
33+Subject: subprocess: Fix communicate_cancelled signature
34+
35+The source callback for a GCancellable should have the cancellable itself
36+as first argument.
37+This was not the case, and when this code was hit, we were instead trying
38+to treat the pointer as a CommunicateState reference and thus wrongly
39+deferencing it, causing a memory error and a crash.
40+
41+Origin: https://gitlab.gnome.org/GNOME/glib/merge_requests/278
42+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/glib2.0/+bug/1789476
43+Applied-upstream: yes, 2.56.3
44+
45+---
46+ gio/gsubprocess.c | 7 +++++--
47+ 1 file changed, 5 insertions(+), 2 deletions(-)
48+
49+diff --git a/gio/gsubprocess.c b/gio/gsubprocess.c
50+index 31822e5..2ce2428 100644
51+--- a/gio/gsubprocess.c
52++++ b/gio/gsubprocess.c
53+@@ -1528,7 +1528,8 @@ g_subprocess_communicate_made_progress (GObject *source_object,
54+ }
55+
56+ static gboolean
57+-g_subprocess_communicate_cancelled (gpointer user_data)
58++g_subprocess_communicate_cancelled (GCancellable *cancellable,
59++ gpointer user_data)
60+ {
61+ CommunicateState *state = user_data;
62+
63+@@ -1580,7 +1581,9 @@ g_subprocess_communicate_internal (GSubprocess *subprocess,
64+ {
65+ state->cancellable_source = g_cancellable_source_new (cancellable);
66+ /* No ref held here, but we unref the source from state's free function */
67+- g_source_set_callback (state->cancellable_source, g_subprocess_communicate_cancelled, state, NULL);
68++ g_source_set_callback (state->cancellable_source,
69++ (GSourceFunc) g_subprocess_communicate_cancelled,
70++ state, NULL);
71+ g_source_attach (state->cancellable_source, g_main_context_get_thread_default ());
72+ }
73+

Subscribers

People subscribed via source and target branches