mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-06 09:26:17 +01:00
array: Abort on overflow
This is a precautionary assert that will probably only trigger on 32bit OSes. But g_nearest_pow() can overflow.
This commit is contained in:
parent
e1d1c78fc8
commit
1cf39a3000
@ -1068,6 +1068,7 @@ g_array_maybe_expand (GRealArray *array,
|
||||
if (want_len > array->elt_capacity)
|
||||
{
|
||||
gsize want_alloc = g_nearest_pow (g_array_elt_len (array, want_len));
|
||||
g_assert (want_alloc >= g_array_elt_len (array, want_len));
|
||||
want_alloc = MAX (want_alloc, MIN_ARRAY_SIZE);
|
||||
|
||||
array->data = g_realloc (array->data, want_alloc);
|
||||
|
Loading…
Reference in New Issue
Block a user