summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2021-03-26 19:48:41 -0400
committerMatthias Clasen <mclasen@redhat.com>2021-03-26 20:27:55 -0400
commitdbcd24adf4b3fccdf23cc98e132fe75f4f63df3f (patch)
tree37cf09c4afdceae1329fd63cc7b96a5296e75617
parent08f68cce403ae73014e03f5dc62640753f290ce7 (diff)
downloadgtk+-dbcd24adf4b3fccdf23cc98e132fe75f4f63df3f.tar.gz
composetable: Limit algorithmic checking
Only check for combinations of up to 2 dead keys with a base character. We don't want to spend ages generating all permutations of long sequences.
-rw-r--r--gtk/gtkcomposetable.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index fb5ab6abe6..7aa9792e3b 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -1190,6 +1190,12 @@ gtk_check_algorithmically (const guint16 *compose_buffer,
for (i = 0; i < n_compose && IS_DEAD_KEY (compose_buffer[i]); i++)
;
+
+ /* Allow at most 2 dead keys */
+ if (i > 2)
+ return FALSE;
+
+ /* Can't combine if there's no base character */
if (i == n_compose)
return TRUE;