Skip to content
Snippets Groups Projects
Commit f2d9f16e authored by Philip Withnall's avatar Philip Withnall
Browse files

gvariant: Handle empty serialisations in get_child_value()


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: default avatarPhilip Withnall <withnall@endlessm.com>
Fixes: #1865
parent 58f12912
No related branches found
No related tags found
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment