Skip to content

Don't cast user-supplied pointers to DBusBasicValue *

Simon McVittie requested to merge smcv/dbus:basic-value-align into master

If we cast a user-supplied pointer to DBusBasicValue *, that's like promising that the pointer is to an object at least as strictly aligned as a DBusBasicValue. In practice, it often isn't: for example, when we marshal a dbus_uint32_t, a pointer to it is only guaranteed to be 32-bit-aligned, whereas DBusBasicValue typically requires 64-bit alignment.


Detected by asan (!57 (merged)).

/cc @thiago: your alignment/aliasing expertise would be appreciated here!

Merge request reports