Missing swapl() in Xext/saver.c?

Mihai Moldovan ionic at ionic.de
Mon Mar 12 04:55:24 UTC 2018


* On 03/12/2018 05:13 AM, Keith Packard wrote:
> Oh. This is pretty bad. 'Bool' is not a valid type in protocol headers,
> it should have been BOOL. And, BOOL is a single byte. But, it is Bool,
> and I guess that is generally 4 bytes on most architectures.
>
> The XCB headers define this field as a byte and have three pad bytes
> afterwards, so we actually have incompatible protocol definitions for
> xcb and xlib/xserver.

I guess I'm about 7 years late to the party, but what has been done has been done.

Yep, xcb-proto files confirm this.

On the bright side, this likely hasn't caused actual issues on most platforms
with CPUs that use LE. CPUs in BE mode are quite rare.


> I'm not entirely sure what we should do at this point; I suspect that
> treating it as a 32-bit value, fixing the protocol to use CARD32
> everywhere instead of Bool and BOOL, and then adding swapl would cause
> the least fuss.

Sounds sane. Reverting to the initially intended BOOL type would cause breakage,
but using CARD32 + swapl() would leave the struct size consistent and fix the
issue in newer versions.

Not particularly clean, but least invasive.

A second option might be to create another request type with the initially
intended interface and stub out the original one, returning BadRequest. Sounds
like overkill, though...



Mihai

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 898 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20180312/f7fa0a67/attachment.sig>


More information about the xorg-devel mailing list