From e6ffee77b61fd3fea71387fcf225321a987a1830 Mon Sep 17 00:00:00 2001 From: Ernestas Kulik Date: Tue, 1 Sep 2020 08:57:14 +0200 Subject: [PATCH] Add patches with upstream fixes --- ...ui-wizard-gtk-wizard-Remove-variable.patch | 39 +++++++++++++++ ...d-gtk-wizard-Fix-invalid-memory-read.patch | 49 +++++++++++++++++++ ...zard-gtk-Fix-a-double-free-condition.patch | 0 ...d-gtk-Fix-a-segfault-and-memory-leak.patch | 0 libreport.spec | 11 +++-- 5 files changed, 96 insertions(+), 3 deletions(-) create mode 100644 0001-gui-wizard-gtk-wizard-Remove-variable.patch create mode 100644 0002-gui-wizard-gtk-wizard-Fix-invalid-memory-read.patch rename 0001-gui-wizard-gtk-Fix-a-double-free-condition.patch => 0003-gui-wizard-gtk-Fix-a-double-free-condition.patch (100%) rename 0002-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch => 0004-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch (100%) diff --git a/0001-gui-wizard-gtk-wizard-Remove-variable.patch b/0001-gui-wizard-gtk-wizard-Remove-variable.patch new file mode 100644 index 0000000..9537db0 --- /dev/null +++ b/0001-gui-wizard-gtk-wizard-Remove-variable.patch @@ -0,0 +1,39 @@ +From 1c646a2948d287368ec1a82b444e8175ebfbf5b9 Mon Sep 17 00:00:00 2001 +From: Ernestas Kulik +Date: Tue, 25 Aug 2020 15:05:31 +0300 +Subject: [PATCH] gui-wizard-gtk: wizard: Remove variable + +cmd_output is no longer used since +440bcfa8526d50f122ec14e19f2bf2aa336f61e7 and trying to call +g_string_free() on it results in a critical warning. +--- + src/gui-wizard-gtk/wizard.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c +index 44900448..a4d7caa0 100644 +--- a/src/gui-wizard-gtk/wizard.c ++++ b/src/gui-wizard-gtk/wizard.c +@@ -231,8 +231,6 @@ typedef struct + + static page_obj_t pages[NUM_PAGES]; + +-static GString *cmd_output = NULL; +- + /* Utility functions */ + + static void clear_warnings(void); +@@ -1667,10 +1665,6 @@ static gboolean consume_cmd_output(GIOChannel *source, GIOCondition condition, g + log_notice("done running event on '%s': %d", g_dump_dir_name, retval); + append_to_textview(g_tv_event_log, "\n"); + +- /* Free child output buffer */ +- g_string_free(cmd_output, TRUE); +- cmd_output = NULL; +- + /* Hide spinner and stop btn */ + gtk_widget_hide(GTK_WIDGET(g_spinner_event_log)); + gtk_widget_hide(g_btn_stop); +-- +2.28.0 + diff --git a/0002-gui-wizard-gtk-wizard-Fix-invalid-memory-read.patch b/0002-gui-wizard-gtk-wizard-Fix-invalid-memory-read.patch new file mode 100644 index 0000000..ed46b09 --- /dev/null +++ b/0002-gui-wizard-gtk-wizard-Fix-invalid-memory-read.patch @@ -0,0 +1,49 @@ +From 85b687098bcedb67285ab787b8bd506d328c34e0 Mon Sep 17 00:00:00 2001 +From: Ernestas Kulik +Date: Tue, 25 Aug 2020 15:17:54 +0300 +Subject: [PATCH] gui-wizard-gtk: wizard: Fix invalid memory read +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This partially reverts 7aba6e53bbfeedaacd95bbaa5e0c5e325a3e6a8d, which +results in “event” being inappropriately freed before a “goto” statement +is executed and the value stored in “g_event_selected” is read. +--- + src/gui-wizard-gtk/wizard.c | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c +index a4d7caa0..3e69a513 100644 +--- a/src/gui-wizard-gtk/wizard.c ++++ b/src/gui-wizard-gtk/wizard.c +@@ -2635,7 +2635,7 @@ static gint select_next_page_no(gint current_page_no) + + log_info("%s: Looking for next event to process", __func__); + /* (note: this frees and sets to NULL g_event_selected) */ +- g_autofree char *event = setup_next_processed_event(&g_auto_event_list); ++ char *event = setup_next_processed_event(&g_auto_event_list); + if (!event) + { + current_page_no = PAGENO_EVENT_PROGRESS - 1; +@@ -2644,6 +2644,8 @@ static gint select_next_page_no(gint current_page_no) + + if (!get_sensitive_data_permission(event)) + { ++ free(event); ++ + cancel_processing(g_lbl_event_log, /* default message */ NULL, TERMINATE_NOFLAGS); + current_page_no = PAGENO_EVENT_PROGRESS - 1; + goto again; +@@ -2659,6 +2661,8 @@ static gint select_next_page_no(gint current_page_no) + + if (libreport_get_global_stop_on_not_reportable()) + { ++ free(event); ++ + cancel_processing(g_lbl_event_log, msg, TERMINATE_NOFLAGS); + current_page_no = PAGENO_EVENT_PROGRESS - 1; + goto again; +-- +2.28.0 + diff --git a/0001-gui-wizard-gtk-Fix-a-double-free-condition.patch b/0003-gui-wizard-gtk-Fix-a-double-free-condition.patch similarity index 100% rename from 0001-gui-wizard-gtk-Fix-a-double-free-condition.patch rename to 0003-gui-wizard-gtk-Fix-a-double-free-condition.patch diff --git a/0002-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch b/0004-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch similarity index 100% rename from 0002-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch rename to 0004-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch diff --git a/libreport.spec b/libreport.spec index c160ab3..2d609f8 100644 --- a/libreport.spec +++ b/libreport.spec @@ -15,13 +15,15 @@ Summary: Generic library for reporting various problems Name: libreport Version: 2.14.0 -Release: 8%{?dist} +Release: 9%{?dist} License: GPLv2+ URL: https://abrt.readthedocs.org/ Source: https://github.com/abrt/%{name}/archive/%{version}/%{name}-%{version}.tar.gz -Patch0: 0001-gui-wizard-gtk-Fix-a-double-free-condition.patch -Patch1: 0002-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch +Patch0: 0001-gui-wizard-gtk-wizard-Remove-variable.patch +Patch1: 0002-gui-wizard-gtk-wizard-Fix-invalid-memory-read.patch +Patch2: 0003-gui-wizard-gtk-Fix-a-double-free-condition.patch +Patch3: 0004-gui-wizard-gtk-Fix-a-segfault-and-memory-leak.patch BuildRequires: %{dbus_devel} BuildRequires: gtk3-devel @@ -662,6 +664,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || : %endif %changelog +* Sun Sep 27 2020 Matěj Grabovský - 2.14.0-9 +- Add upstream fixes for memory management + * Sun Sep 27 2020 Matěj Grabovský - 2.14.0-8 - Add fix for https://bugzilla.redhat.com/show_bug.cgi?id=1882950