From: Benjamin Otte Date: Wed, 20 Sep 2023 00:46:47 +0000 (+0200) Subject: array: Compute new size properly X-Git-Tag: archive/raspbian/4.12.4+ds-3+rpi1^2~21^2~1^2~15 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bbe7e8555d358ddb61cd19ef07e90d9a5c9a8494;p=gtk4.git 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. --- diff --git a/gdk/gdkarrayimpl.c b/gdk/gdkarrayimpl.c index a18ab5e33d..408cb3b0d2 100644 --- a/gdk/gdkarrayimpl.c +++ b/gdk/gdkarrayimpl.c @@ -151,7 +151,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)