summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-05-02 08:26:38 +0000
committerMatthias Clasen <mclasen@redhat.com>2022-05-02 08:26:38 +0000
commit35cd02cd1ee4a3cf53db91fff545bcf2c178fa63 (patch)
treeb72a1043a90d071a52f1c099c653b735bb3fc228
parentb3f04413b486bd3eb7fbb13658b60aa4c517cd1c (diff)
parent2b183a9f4e90b7348380dab4ecd8141f608d8ae4 (diff)
downloadgtk+-35cd02cd1ee4a3cf53db91fff545bcf2c178fa63.tar.gz
Merge branch 'fix-large-compose-file' into 'main'
composetable: Add a missing NULL check Closes #4873 See merge request GNOME/gtk!4679
-rw-r--r--gtk/gtkcomposetable.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index 7951b04c4d..eda1e5ad5b 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -942,7 +942,12 @@ parser_get_compose_table (GtkComposeParser *parser)
if (char_data->len > 0)
g_string_append_c (char_data, 0);
- g_assert (char_data->len < 0x8000);
+ if (char_data->len >= 0x8000)
+ {
+ g_warning ("GTK can't handle compose tables this large (%s)", parser->compose_file ? parser->compose_file : "");
+ g_string_free (char_data, TRUE);
+ return NULL;
+ }
encoded_value = (guint16) (char_data->len | 0x8000);
g_string_append (char_data, value);
@@ -1150,7 +1155,8 @@ parse:
* is probably a copy of the system one, we take steps to keep things working,
* and thell the user about it.
*/
- if (found_old_cache && !found_include && compose_table->n_sequences < 100)
+ if (found_old_cache && !found_include &&
+ compose_table != NULL && compose_table->n_sequences < 100)
{
if (rewrite_compose_file (compose_file))
{