diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2016-02-15 13:52:52 +0000 |
---|---|---|
committer | Simon McVittie <smcv@debian.org> | 2016-03-02 18:17:57 +0000 |
commit | 64d6dbd190f5d58768fbf290747b06e464d44b00 (patch) | |
tree | 165cdcc658282052cd7a4cbab1aace61baca4017 | |
parent | 38a5c3028ed27c4ceeffc32ddb17d1a8fe4fd0dd (diff) | |
download | dbus-64d6dbd190f5d58768fbf290747b06e464d44b00.tar.gz |
Statically assert that the DBusMessageIter struct has no padding
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Thiago Macieira <thiago@kde.org>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=94136
-rw-r--r-- | dbus/dbus-message.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/dbus/dbus-message.c b/dbus/dbus-message.c index abdc11f3..e22fe51b 100644 --- a/dbus/dbus-message.c +++ b/dbus/dbus-message.c @@ -2058,6 +2058,11 @@ _dbus_message_iter_init_common (DBusMessage *message, sizeof (DBusMessageIter)); _DBUS_STATIC_ASSERT (_DBUS_ALIGNOF (DBusMessageIter_1_10_0) == _DBUS_ALIGNOF (DBusMessageIter)); + /* If this static assertion fails, it means the DBusMessageIter struct + * is not "packed", which might result in "iter = other_iter" not copying + * every byte. */ + _DBUS_STATIC_ASSERT (sizeof (DBusMessageIter) == + 4 * sizeof (void *) + sizeof (dbus_uint32_t) + 9 * sizeof (int)); /* Since the iterator will read or write who-knows-what from the * message, we need to get in the right byte order |