Do not apply __attribute__((__malloc__)) to dbus_realloc()
authorSimon McVittie <smcv@collabora.com>
Thu, 23 Aug 2018 08:01:03 +0000 (09:01 +0100)
committerSimon McVittie <smcv@collabora.com>
Thu, 30 Aug 2018 16:34:25 +0000 (17:34 +0100)
commit4a0867a8fc2db6a23dba68667d0e6010e3082fe8
treee8674d4ae0863cd7d657a2ffd3033fbcc408584c
parent28450e78070f3502214146f0da61c5267eadceeb
Do not apply __attribute__((__malloc__)) to dbus_realloc()

As noted in GLib commit c879f50f, gcc's interpretation of the malloc
attribute has become more strict over time, which could result in
miscompilation. The new definition is that in addition to assuming
that the returned memory block is newly-allocated, gcc now assumes
that it does not contain any valid pointers. This is OK for
uninitialized or zero-initialized memory returned by dbus_malloc()
or dbus_malloc0(), but not valid for dbus_realloc(), which might be
used for a dynamically-sized array of (structures containing)
valid pointers.

See https://gitlab.gnome.org/GNOME/glib/issues/1465

Signed-off-by: Simon McVittie <smcv@collabora.com>
Reviewed-by: Philip Withnall <withnall@endlessm.com>
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=107741
dbus/dbus-memory.h