[Xcb] XGE malloc bug - too small due to xcb struct padding

Keith Packard keithp at keithp.com
Sun Dec 29 09:38:21 PST 2013

Mark Kettenis <mark.kettenis at xs4all.nl> writes:

> That isn't the right answer.  The 64-bit fields will be misaligned and
> accessing them on a strict alignment architecture will trigger a bus
> error.

Oh. I just realized that the problem here is rooted in the fact that
Present uses 64-bit native datatypes on the wire. I believe this is a
novelty; X has been limited to 32-bit datatypes in the past, which would
mean that the struct itself could be allocated on a 32-bit boundary, and
the original code would have worked for any extension *not* using 64-bit
datatypes past the 32-byte event struct size.

The most cautious approach to fixing this would be to only pad events to
64-bit boundaries which included 64-bit types. That seems harder...

keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 827 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/xcb/attachments/20131229/04c06eff/attachment-0001.pgp>

More information about the Xcb mailing list