Backport upstream patches to fix regressions in Compose file parsing
This commit is contained in:
		
							parent
							
								
									7c30cfe301
								
							
						
					
					
						commit
						f3b0c8b477
					
				| @ -0,0 +1,78 @@ | ||||
| From 22960c5c20cf5a2d4666645f259d376784a11331 Mon Sep 17 00:00:00 2001 | ||||
| From: Matthias Clasen <mclasen@redhat.com> | ||||
| 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 | ||||
| 
 | ||||
							
								
								
									
										41
									
								
								0002-imcontext-Be-more-lenient-in-parsing-Compose.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								0002-imcontext-Be-more-lenient-in-parsing-Compose.patch
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,41 @@ | ||||
| From d11cde0c1cd01b6db59605fef95b746620011e08 Mon Sep 17 00:00:00 2001 | ||||
| From: Matthias Clasen <mclasen@redhat.com> | ||||
| 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 | ||||
| 
 | ||||
| @ -19,13 +19,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} | ||||
| @ -315,6 +319,9 @@ gtk-query-immodules-3.0-%{__isa_bits} --update-cache &>/dev/null || : | ||||
| %{_datadir}/installed-tests/ | ||||
| 
 | ||||
| %changelog | ||||
| * Mon Feb 15 2021 Kalev Lember <klember@redhat.com> - 3.24.25-2 | ||||
| - Backport upstream patches to fix regressions in Compose file parsing | ||||
| 
 | ||||
| * Fri Feb 12 2021 Kalev Lember <klember@redhat.com> - 3.24.25-1 | ||||
| - Update to 3.24.25 | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user