mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 14:10:30 +00:00
Merge branch 'gtk-fix-issue-4990' into 'main'
Add check for large compose files Closes #4990 See merge request GNOME/gtk!6195
This commit is contained in:
commit
99d6a15049
@ -980,6 +980,7 @@ parser_get_compose_table (GtkComposeParser *parser)
|
||||
current_first = (guint16)sequence[0];
|
||||
|
||||
data[first_pos] = (guint16)sequence[0];
|
||||
|
||||
for (i = 1; i < index_rowstride; i++)
|
||||
data[first_pos + i] = rest_pos;
|
||||
}
|
||||
@ -998,6 +999,14 @@ parser_get_compose_table (GtkComposeParser *parser)
|
||||
|
||||
rest_pos += len;
|
||||
|
||||
if (rest_pos >= 0x8000)
|
||||
{
|
||||
g_warning ("GTK can't handle compose tables this large (%s)", parser->compose_file ? parser->compose_file : "");
|
||||
g_free (data);
|
||||
g_string_free (char_data, TRUE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (i = len + 1; i < index_rowstride; i++)
|
||||
data[first_pos + i] = rest_pos;
|
||||
|
||||
|
34493
testsuite/gtk/compose/large
Normal file
34493
testsuite/gtk/compose/large
Normal file
File diff suppressed because it is too large
Load Diff
@ -405,6 +405,28 @@ match_algorithmic (void)
|
||||
g_string_free (output, TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
compose_table_large (void)
|
||||
{
|
||||
if (g_test_subprocess ())
|
||||
{
|
||||
char *file;
|
||||
GtkComposeTable *table;
|
||||
|
||||
file = g_test_build_filename (G_TEST_DIST, "compose", "large", NULL);
|
||||
|
||||
table = gtk_compose_table_parse (file, NULL);
|
||||
g_assert_nonnull (table);
|
||||
g_free (file);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
g_test_trap_subprocess (NULL, 0, 0);
|
||||
g_test_trap_assert_stderr ("*can't handle compose tables this large*");
|
||||
g_test_trap_assert_failed ();
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char *argv[])
|
||||
{
|
||||
@ -444,6 +466,7 @@ main (int argc, char *argv[])
|
||||
g_test_add_func ("/compose-table/match", compose_table_match);
|
||||
g_test_add_func ("/compose-table/match-builtin", compose_table_match_builtin);
|
||||
g_test_add_func ("/compose-table/match-algorithmic", match_algorithmic);
|
||||
g_test_add_func ("/compose-table/large", compose_table_large);
|
||||
|
||||
return g_test_run ();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user