gvariant: fix recursing into empty array 81/175481/1
authorAdrian Szyndela <adrian.s@samsung.com>
Tue, 10 Apr 2018 13:58:13 +0000 (15:58 +0200)
committerAdrian Szyndela <adrian.s@samsung.com>
Tue, 10 Apr 2018 14:10:13 +0000 (16:10 +0200)
commit95868b1c8cf9d7e8eec1daf2e944e4e14ec6010f
treeb50a528055a002d56d220b892f55bcf092a9f8fd
parent10ba7c55d1dfcbcaf721a4a0cc14095ef51d36cd
gvariant: fix recursing into empty array

In GVariant, arrays of variable size values have offsets at the end.
We need to know how many offsets are in an array when we recurse
into it. To count the offsets we need to have offsets size and
the start and end of the offsets. The start of the offsets
is computed from the value of the last offset.

On the other hand, empty arrays have size equal to zero. In other words,
they have no offsets. Function _dbus_reader_count_array_elems missed it.

This commit fixes _dbus_reader_count_array_elems() by ensuring returning 0
when an array is empty.

Change-Id: I17cbf7a2fef6524353e06166e5f996040da3aadf
dbus/dbus-marshal-gvariant.c