Backport !1043 “gvariant: Handle empty serialisations in get_child_value()” to glib-2-62
When g_variant_get_child_value() is called for a child whose
serialisation is an empty byte string (which is possible), bytes_data
will be non-NULL
, but data
may be NULL
. This results in a negative
offset being passed to g_bytes_new_from_bytes()
, and a critical
warning.
So if data
is NULL
, set it to point to bytes_data
so the offset is
calculated as zero. The actual value of the offset doesn’t matter, since
in this situation the size is always zero. An offset of zero is never
going to cause problems.
Signed-off-by: Philip Withnall withnall@endlessm.com Fixes: #1865 (closed)
Trivial cherry pick of !1043 (merged).