Fix g_array_insert_vals() with an index off the end of the array
Submitted by Philip Withnall
Currently, calling g_array_insert_vals() with an index which is off the end of the array results in a crash in memmove(). Given that GArray supports clearing newly created elements when setting the array larger than its current size using g_array_set_size(), it seems appropriate to allow this with g_array_insert_vals().
Patch series coming up which fixes this and adds lots of test coverage for various bits of GArray (from looking at the missing branch coverage on our existing tests: https://gnome.pages.gitlab.gnome.org/glib/coverage/glib/garray.c.gcov.html).
If we decide we want to disallow g_array_insert_vals() from being called with out-of-bounds indexes, that’s also fine; I can rearrange the patches to add a g_return_val_if_fail() on the index instead (as per bug #414301).