mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 21:21:21 +00:00
gtkcomposetable: use g_size_checked_mul() for overflow checking
The check was added in !741, this replaces it with g_size_checked_mul()
This commit is contained in:
parent
c5a4a26f06
commit
b66e4cd64c
@ -837,7 +837,6 @@ gtk_compose_table_list_add_array (GSList *compose_tables,
|
||||
GtkComposeTable *compose_table;
|
||||
gsize n_index_stride;
|
||||
gsize length;
|
||||
gsize max_size = (gsize) -1;
|
||||
int i;
|
||||
guint16 *gtk_compose_seqs = NULL;
|
||||
|
||||
@ -845,13 +844,12 @@ gtk_compose_table_list_add_array (GSList *compose_tables,
|
||||
g_return_val_if_fail (max_seq_len <= GTK_MAX_COMPOSE_LEN, compose_tables);
|
||||
|
||||
n_index_stride = MIN (max_seq_len, GTK_MAX_COMPOSE_LEN) + 2;
|
||||
if (n_seqs > max_size / n_index_stride)
|
||||
if (!g_size_checked_mul (&length, n_index_stride, n_seqs))
|
||||
{
|
||||
g_critical ("Overflow in the compose sequences");
|
||||
return compose_tables;
|
||||
}
|
||||
|
||||
length = n_index_stride * n_seqs;
|
||||
hash = gtk_compose_table_data_hash (data, length);
|
||||
|
||||
if (g_slist_find_custom (compose_tables, GINT_TO_POINTER (hash), gtk_compose_table_find) != NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user