[gtk: 1/2] gtkcomposetable: use g_size_checked_mul() for overflow checking
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 1/2] gtkcomposetable: use g_size_checked_mul() for overflow checking
- Date: Fri, 12 Apr 2019 22:19:53 +0000 (UTC)
commit b66e4cd64c939d5a1fb83dd1ebb6adabbf95ac01
Author: Christoph Reiter <creiter src gnome org>
Date: Fri Apr 12 22:38:44 2019 +0200
gtkcomposetable: use g_size_checked_mul() for overflow checking
The check was added in !741, this replaces it with g_size_checked_mul()
gtk/gtkcomposetable.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
---
diff --git a/gtk/gtkcomposetable.c b/gtk/gtkcomposetable.c
index e451cdb3bf..c355c6a7bd 100644
--- a/gtk/gtkcomposetable.c
+++ b/gtk/gtkcomposetable.c
@@ -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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]