Xrender and 64bit

Michael <[email protected]>
Newsgroups gmane.comp.xfree86.devel
Message-ID <20050724195049.715b6efd@inishowen>
Hello,

I recently found out that whoever wrote Xrender apparently didn't waste
a single thought on 64bit systems. Base types are unsigned longs ( see
X11/extensions/render.h ):

typedef unsigned long	Glyph;
typedef unsigned long	GlyphSet;
typedef unsigned long	Picture;
typedef unsigned long	PictFormat;

but everything seems to assume they're size 4 bytes and goes some
lengths to ensure 4 byte alignment but this still leads to occasional
SIGBUS from Xserver/render/render.c, especially
ProcRenderCompositeGlyph(). A quick, working but dead ugly 'fix' is
this: 

Index: render.c
=================================================================== 
RCS file: /cvsroot/xsrc/xfree/xc/programs/Xserver/render/render.c,v
retrieving revision 1.1.1.6 diff -u -w -r1.1.1.6 render.c 
--- render.c 18 Mar 2005 13:13:16 -0000      1.1.1.6 
+++ render.c    24 Jul 2005 17:46:09 -0000 
@@ -1300,7 +1300,7 @@
        {
            if (buffer + sizeof (GlyphSet) < end)
            {
-               gs = *(GlyphSet *) buffer;
+               gs = *(CARD32 *) buffer;
                glyphSet = (GlyphSetPtr) SecurityLookupIDByType (client,
                                                                 gs,
                                               			 GlyphSetType, 

A real fix would be to change the base types to something that's always
32bit I think but that would disrupt more or less everything that uses
Xrender since they're exposed to clients.

Any ideas what to do about this? On sparc64 this leads to firefox
occasionally crashing the Xserver and I'm pretty sure it would affect
other 64bit architectures as well.

have fun
Michael
signature.asc (application/pgp-signature, 478 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (NetBSD)

iQEVAwUBQuQpWcpnzkX8Yg2nAQKLFAgAuqkNE+HbHpA1B9a/0d2RkquNb3hwGI0l
V2eS4qv05HptGUzskh2ElvdIPc8krtD8iDQzwMFY39lvfFk2hNKGZSbursZP46vE
G9BOxFnsQyLr3rquPVjdiyw/6lAsplGiK1Eit3JPTxCufX3GPqMNn5hd+LN8rrxd
vIu/OP4TH9fpxHJghOfgSPo2zxg0V8ufjS/ZeeHf19FDTxF8QlUwKKvcm+OGNd7l
1KxIyF20XJlAVUq3GfRPO9AA8nNpDW1QhrftiYgRCM/7FhEoUsjGrc6xHpEkhOLV
0ibMLaGobc9O7i47DdXanxeDfyN1JS05ZitiJB1c6kdxKTCNJx8rlQ==
=S6el
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.