gvariant: Fix a potential memcpy(NULL) call
commitc1d5db618688a78aa897d269859a1bc6413a9e55
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Mon, 25 Nov 2013 13:50:20 +0000 (25 13:50 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 27 Nov 2013 10:05:56 +0000 (27 10:05 +0000)
tree151b6a43c0723ec33a20eadc0ba5795d6a35544d
parentc9344fd5135474471dc34e29141a186454e7473e
gvariant: Fix a potential memcpy(NULL) call

This probably won’t crash, as it can only happen if (size == 0), but
add a check to be safe, and to shut up the static analyser.

This case can be reached with the following call:
    gvs_read_unaligned_le(NULL, 0)
which can be called from:
    gvs_tuple_get_child(value, index_)
with (value.data == NULL) and (value.size == 0).

Found by scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=715164
glib/gvariant-serialiser.c