glib/tests/array-test.c:1828:pointer_array_new_from_null_terminated_array_from_gstrv: 'g_ptr_array_index (gparray, 4)' should be NULL
I'm seeing this test failure after trying to package GLib 2.75.2 for Debian experimental:
Bail out! GLib:ERROR:../../../glib/tests/array-test.c:1828:pointer_array_new_from_null_terminated_array_from_gstrv: 'g_ptr_array_index (gparray, 4)' should be NULL
I think this is because g_ptr_array_new_from_null_terminated_array()
makes sure to allocate enough space for NULL termination (in this case at least 5 pointers), and it memcpys the 4 non-null elements of the strv into the array's pdata, but it does not make any special arrangements to update the NULL termination, resulting in the array's pdata being { "A", "dot", "separated", "string", <uninitialized> }
instead of the desired { "A", "dot", "separated", "string", NULL }
- but with some compilers and compiler options, the uninitialized pdata[4]
might be NULL accidentally, resulting in a test pass.
MR to follow.
/cc @3v1n0