mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
array: Compute new size properly
Using "1 << x" means that we are shifting a signed 32bit integer, but we want a gsize, which is an unsigned 64bit integer. So now we don't overflow anymore if the array reaches a size of 2GB.
This commit is contained in:
parent
1e24aa425e
commit
9c636a6136
@ -183,7 +183,7 @@ gdk_array(reserve) (GdkArray *self,
|
||||
return;
|
||||
|
||||
size = gdk_array(get_size) (self);
|
||||
new_size = 1 << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
||||
new_size = ((gsize) 1) << g_bit_storage (MAX (GDK_ARRAY_REAL_SIZE (n), 16) - 1);
|
||||
|
||||
#ifdef GDK_ARRAY_PREALLOC
|
||||
if (self->start == self->preallocated)
|
||||
|
Loading…
Reference in New Issue
Block a user