• Will Thompson's avatar
    GDBusMessage: do not align for grandchildren of empty arrays. · 113f4abb
    Will Thompson authored
    D-Bus arrays are serialized as follows:
    1. align to a 4-byte boundary (for the length)
    2. uint32: the length of the serialized body in bytes
    3. padding for the alignment of the body type (not included in the length)
    4. the body.
    Note that 3. is a no-op unless the body type is an 8-byte aligned type
    (uint64, int64, double, struct, dict_entry), since you are always on a
    4-byte boundary from aligning and writing the length.
    So, an empty aax (that is, an array containing zero arrays of int64)
    is serialized as follows:
    1. align to a 4-byte boundary
    2. length of the contents of this (empty) array, in bytes (0)
    3. align to a 4-byte boundary (the child array's alignment requirement)
    4. there is no body.
    But previously, GDBus would recurse in step three to align not just for
    the type of the child array, but for the nonexistent child array's
    contents. This only affects the algorithm when the grandchild type has
    8-byte alignment and the reader happened to not already be on an 8-byte
    boundary, in which case 4 bytes were spuriously skipped.
    https://bugzilla.gnome.org/show_bug.cgi?id=673612Signed-off-by: 's avatarDavid Zeuthen <davidz@redhat.com>
gdbusmessage.c 99.1 KB