From 3d78934b161d7801a193e08c6d94227ff0075963 Mon Sep 17 00:00:00 2001 From: Kalev Lember Date: Mon, 15 Feb 2021 21:59:55 +0100 Subject: Backport upstream patches to fix regressions in Compose file parsing --- ...-Fix-a-regression-in-Compose-file-parsing.patch | 78 ++++++++++++++++++++++ ...ontext-Be-more-lenient-in-parsing-Compose.patch | 41 ++++++++++++ gtk3.spec | 9 ++- 3 files changed, 127 insertions(+), 1 deletion(-) create mode 100644 0001-imcontext-Fix-a-regression-in-Compose-file-parsing.patch create mode 100644 0002-imcontext-Be-more-lenient-in-parsing-Compose.patch diff --git a/0001-imcontext-Fix-a-regression-in-Compose-file-parsing.patch b/0001-imcontext-Fix-a-regression-in-Compose-file-parsing.patch new file mode 100644 index 0000000..04614a4 --- /dev/null +++ b/0001-imcontext-Fix-a-regression-in-Compose-file-parsing.patch @@ -0,0 +1,78 @@ +From 22960c5c20cf5a2d4666645f259d376784a11331 Mon Sep 17 00:00:00 2001 +From: Matthias Clasen +Date: Sun, 14 Feb 2021 11:54:05 -0500 +Subject: [PATCH 1/3] imcontext: Fix a regression in Compose file parsing + +We accidentally dropped the handing of # comments. +Bring it back. + +Fixes: #3664 +--- + gtk/gtkcomposetable.c | 30 ++++++++++++++++++++---------- + 1 file changed, 20 insertions(+), 10 deletions(-) + +diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c +index 95cb16f9b8..f8657d2660 100644 +--- a/gtk/gtkcomposetable.c ++++ b/gtk/gtkcomposetable.c +@@ -77,28 +77,40 @@ parse_compose_value (GtkComposeData *compose_data, + const char *val, + const char *line) + { +- char *word; + const char *p; +- gsize len; + GString *value; + gunichar ch; + char *endp; + +- len = strlen (val); +- if (val[0] != '"' || val[len - 1] != '"') ++ if (val[0] != '"') + { + g_warning ("Need to double-quote the value: %s: %s", val, line); + goto fail; + } + +- word = g_strndup (val + 1, len - 2); +- + value = g_string_new (""); + +- p = word; ++ p = val + 1; + while (*p) + { +- if (*p == '\\') ++ if (*p == '\0') ++ { ++ g_warning ("Missing closing '\"': %s: %s", val, line); ++ goto fail; ++ } ++ else if (*p == '\"') ++ { ++ p++; ++ while (*p && g_ascii_isspace (*p)) ++ p++; ++ if (*p != '\0' && *p != '#') ++ { ++ g_warning ("Garbage after closing '\"': %s: %s", val, line); ++ goto fail; ++ } ++ break; ++ } ++ else if (*p == '\\') + { + if (p[1] == '"') + { +@@ -148,8 +160,6 @@ parse_compose_value (GtkComposeData *compose_data, + + compose_data->value = g_string_free (value, FALSE); + +- g_free (word); +- + return TRUE; + + fail: +-- +2.29.2 + diff --git a/0002-imcontext-Be-more-lenient-in-parsing-Compose.patch b/0002-imcontext-Be-more-lenient-in-parsing-Compose.patch new file mode 100644 index 0000000..138885f --- /dev/null +++ b/0002-imcontext-Be-more-lenient-in-parsing-Compose.patch @@ -0,0 +1,41 @@ +From d11cde0c1cd01b6db59605fef95b746620011e08 Mon Sep 17 00:00:00 2001 +From: Matthias Clasen +Date: Sun, 14 Feb 2021 12:56:00 -0500 +Subject: [PATCH 2/3] imcontext: Be more lenient in parsing Compose + +X11 allows keysyms to be specified in addition to strings. +We only support the strings. In the past, we ignored everything +after the string. Go back to doing that, but issue a warning +that we've ignored the keysym. +--- + gtk/gtkcomposetable.c | 7 ++----- + 1 file changed, 2 insertions(+), 5 deletions(-) + +diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c +index f8657d2660..6d88665f8b 100644 +--- a/gtk/gtkcomposetable.c ++++ b/gtk/gtkcomposetable.c +@@ -84,7 +84,7 @@ parse_compose_value (GtkComposeData *compose_data, + + if (val[0] != '"') + { +- g_warning ("Need to double-quote the value: %s: %s", val, line); ++ g_warning ("Only strings supported after ':': %s: %s", val, line); + goto fail; + } + +@@ -104,10 +104,7 @@ parse_compose_value (GtkComposeData *compose_data, + while (*p && g_ascii_isspace (*p)) + p++; + if (*p != '\0' && *p != '#') +- { +- g_warning ("Garbage after closing '\"': %s: %s", val, line); +- goto fail; +- } ++ g_warning ("Ignoring keysym after string: %s: %s", val, line); + break; + } + else if (*p == '\\') +-- +2.29.2 + diff --git a/gtk3.spec b/gtk3.spec index b9b49fe..ec53c78 100644 --- a/gtk3.spec +++ b/gtk3.spec @@ -25,13 +25,17 @@ Name: gtk3 Version: 3.24.25 -Release: 1%{?dist} +Release: 2%{?dist} Summary: GTK+ graphical user interface library License: LGPLv2+ URL: http://www.gtk.org Source0: http://download.gnome.org/sources/gtk+/3.24/gtk+-%{version}.tar.xz +# Backported from upstream +Patch1: 0001-imcontext-Fix-a-regression-in-Compose-file-parsing.patch +Patch2: 0002-imcontext-Be-more-lenient-in-parsing-Compose.patch + BuildRequires: pkgconfig(atk) >= %{atk_version} BuildRequires: pkgconfig(atk-bridge-2.0) BuildRequires: pkgconfig(glib-2.0) >= %{glib2_version} @@ -326,6 +330,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &>/dev/null || : %{_datadir}/installed-tests/ %changelog +* Mon Feb 15 2021 Kalev Lember - 3.24.25-2 +- Backport upstream patches to fix regressions in Compose file parsing + * Fri Feb 12 2021 Kalev Lember - 3.24.25-1 - Update to 3.24.25 -- cgit