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

Attachment: pgpRjsdNR20SZ.pgp
Description: PGP signature

Reply via email to