mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-16 07:04:29 +00:00
Merge branch 'validate-alloc-size' into 'master'
Check the size of the g_new arguments See merge request GNOME/gtk!741
This commit is contained in:
commit
e81f033ece
@ -835,14 +835,23 @@ gtk_compose_table_list_add_array (GSList *compose_tables,
|
|||||||
{
|
{
|
||||||
guint32 hash;
|
guint32 hash;
|
||||||
GtkComposeTable *compose_table;
|
GtkComposeTable *compose_table;
|
||||||
int n_index_stride = max_seq_len + 2;
|
gsize n_index_stride;
|
||||||
int length = n_index_stride * n_seqs;
|
gsize length;
|
||||||
|
gsize max_size = (gsize) -1;
|
||||||
int i;
|
int i;
|
||||||
guint16 *gtk_compose_seqs = NULL;
|
guint16 *gtk_compose_seqs = NULL;
|
||||||
|
|
||||||
g_return_val_if_fail (data != NULL, compose_tables);
|
g_return_val_if_fail (data != NULL, compose_tables);
|
||||||
g_return_val_if_fail (max_seq_len <= GTK_MAX_COMPOSE_LEN, 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)
|
||||||
|
{
|
||||||
|
g_critical ("Overflow in the compose sequences");
|
||||||
|
return compose_tables;
|
||||||
|
}
|
||||||
|
|
||||||
|
length = n_index_stride * n_seqs;
|
||||||
hash = gtk_compose_table_data_hash (data, length);
|
hash = gtk_compose_table_data_hash (data, length);
|
||||||
|
|
||||||
if (g_slist_find_custom (compose_tables, GINT_TO_POINTER (hash), gtk_compose_table_find) != NULL)
|
if (g_slist_find_custom (compose_tables, GINT_TO_POINTER (hash), gtk_compose_table_find) != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user