From 4e821a174a5262b1602ef68a78b304d906a2ffac Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 12 Jun 2024 16:09:11 -0700 Subject: [PATCH] Fix various openscan issues Resolves: RHEL-38648 --- libadwaita.spec | 3 +++ mismatched-va_args.patch | 52 ++++++++++++++++++++++++++++++++++++++++ plug-cond_1-leak.patch | 48 +++++++++++++++++++++++++++++++++++++ 3 files changed, 103 insertions(+) create mode 100644 mismatched-va_args.patch create mode 100644 plug-cond_1-leak.patch diff --git a/libadwaita.spec b/libadwaita.spec index ee7e37f..e0584dd 100644 --- a/libadwaita.spec +++ b/libadwaita.spec @@ -14,6 +14,9 @@ License: LGPL-2.1-or-later AND MIT URL: https://gitlab.gnome.org/GNOME/libadwaita Source0: https://download.gnome.org/sources/%{name}/1.5/%{name}-%{tarball_version}.tar.xz +Patch0: mismatched-va_args.patch +Patch1: plug-cond_1-leak.patch + BuildRequires: desktop-file-utils BuildRequires: gcc BuildRequires: gettext diff --git a/mismatched-va_args.patch b/mismatched-va_args.patch new file mode 100644 index 0000000..1f49fce --- /dev/null +++ b/mismatched-va_args.patch @@ -0,0 +1,52 @@ +From a717b3ee38bdf348ede2992de6b2345200f4f468 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 12 Jun 2024 15:48:06 -0700 +Subject: [PATCH] va_args: fix umatched va_start() + +va_list on some architectures require a va_end() to restore state which +may have been spilled. In this case it is easier to just avoid calling +va_start() altogether. +--- + src/adw-alert-dialog.c | 4 ++-- + src/adw-message-dialog.c | 4 ++-- + 2 files changed, 4 insertions(+), 4 deletions(-) + +diff --git a/src/adw-alert-dialog.c b/src/adw-alert-dialog.c +index 7c002a4a..48d5d773 100644 +--- a/src/adw-alert-dialog.c ++++ b/src/adw-alert-dialog.c +@@ -1784,11 +1784,11 @@ adw_alert_dialog_add_responses (AdwAlertDialog *self, + + g_return_if_fail (ADW_IS_ALERT_DIALOG (self)); + +- va_start (args, first_id); +- + if (!first_id) + return; + ++ va_start (args, first_id); ++ + id = first_id; + label = va_arg (args, const char *); + +diff --git a/src/adw-message-dialog.c b/src/adw-message-dialog.c +index cb3d3548..e36876fd 100644 +--- a/src/adw-message-dialog.c ++++ b/src/adw-message-dialog.c +@@ -1917,11 +1917,11 @@ adw_message_dialog_add_responses (AdwMessageDialog *self, + + g_return_if_fail (ADW_IS_MESSAGE_DIALOG (self)); + +- va_start (args, first_id); +- + if (!first_id) + return; + ++ va_start (args, first_id); ++ + id = first_id; + label = va_arg (args, const char *); + +-- +2.45.1 + diff --git a/plug-cond_1-leak.patch b/plug-cond_1-leak.patch new file mode 100644 index 0000000..b202495 --- /dev/null +++ b/plug-cond_1-leak.patch @@ -0,0 +1,48 @@ +From 3b9f98fb670b97911fc0d307d22cbf87e6ad27e6 Mon Sep 17 00:00:00 2001 +From: Christian Hergert +Date: Wed, 12 Jun 2024 16:03:12 -0700 +Subject: [PATCH] breakpoint: plug leak of cond_1 in failure paths + +--- + src/adw-breakpoint.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/adw-breakpoint.c b/src/adw-breakpoint.c +index 3d69420c4..eb2710ea3 100644 +--- a/src/adw-breakpoint.c ++++ b/src/adw-breakpoint.c +@@ -642,6 +642,7 @@ parse_multi (const char *str, + return cond_1; + } else { + *error = CONDITION_PARSER_ERROR_UNKNOWN_OPERATOR; ++ g_clear_pointer (&cond_1, adw_breakpoint_condition_free); + return NULL; + } + +@@ -650,6 +651,7 @@ parse_multi (const char *str, + } else { + *endp = (char *) str; + *error = CONDITION_PARSER_ERROR_UNEXPECTED_CHARACTER; ++ g_clear_pointer (&cond_1, adw_breakpoint_condition_free); + return NULL; + } + +@@ -663,6 +665,7 @@ parse_multi (const char *str, + + if (!cond_2) { + *endp = (char *) str; ++ g_clear_pointer (&cond_1, adw_breakpoint_condition_free); + return NULL; + } + +@@ -679,6 +682,7 @@ parse_multi (const char *str, + + if (!cond_2) { + *endp = (char *) str; ++ g_clear_pointer (&cond_1, adw_breakpoint_condition_free); + return NULL; + } + +-- +GitLab +