Flash/Mozilla/Composite bug details?

Keith Packard keithp at keithp.com
Fri Aug 13 14:33:14 PDT 2004


Around 17 o'clock on Aug 13, Kevin E Martin wrote:

> Interesting.  I haven't seen this fix or the other (more-invasive) fix,
> so I don't really know how to evaluate them.  But generally speaking,
> while it's nice to limit the changes, my only concern is that there
> might be other ways "broken" programs could crash.

Yeah, we really won't know what bugs are out there until lots more people 
do testing.  Perhaps the simple sledge-hammer fix would be better so that 
people could work around this and future bugs easily.

Let me describe the two fixes.

The original (sledge hammer) fix was to eliminate all visuals of depth 32 
right in XOpenDisplay.  This fix is short and sweet:

diff -u -r1.2 OpenDis.c
--- OpenDis.c   23 Apr 2004 18:43:24 -0000      1.2
+++ OpenDis.c   13 Aug 2004 21:30:49 -0000
@@ -570,6 +570,12 @@
                        u.vp = (xVisualType *) (((char *) u.vp) +
                                                sz_xVisualType);
                    }
+                   if (dp->depth == 32 && getenv ("XLIB_SKIP_ARGB_VISUALS"))
+                   {
+                       Xfree (dp->visuals);
+                       dp->visuals = NULL;
+                       dp->nvisuals = 0;
+                   }
                } else {
                    dp->visuals = (Visual *) NULL;
                }

The new and improved (velvet knife) fix is to hide ARGB visuals from the 
API used by Flash:

Index: VisUtil.c
===================================================================
RCS file: /cvs/xlibs/X11/src/VisUtil.c,v
retrieving revision 1.3
diff -u -r1.3 VisUtil.c
--- VisUtil.c   5 Mar 2004 09:16:42 -0000       1.3
+++ VisUtil.c   13 Aug 2004 21:31:35 -0000
@@ -224,6 +224,26 @@
           {
             if (vp->class == class)
               {
+#if 1
+               /*
+                * Flash has a bug where it ends up using an ARGB visual
+                * by accident.  Avoid this by skipping the ARGB visual
+                * in this function.  We identify an ARGB visual as one
+                * which has bits beyond red/green/blue in depth
+                */
+               unsigned long   allbits = vp->red_mask | vp->green_mask | vp->b!
+               unsigned long   ones;
+
+               ones = (allbits >> 1) &033333333333;
+               ones = allbits - ones - ((ones >>1) & 033333333333);
+               ones = (((ones + (ones >> 3)) & 030707070707) % 077);
+
+               if (ones != depth && getenv ("XLIB_SKIP_ARGB_VISUALS"))
+                 {
+                   vp++;
+                   continue;
+                 }
+#endif
                visual_info->visual = _XVIDtoVisual(dpy, vp->visualid);
                visual_info->visualid = vp->visualid;
                visual_info->screen = screen;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
Url : http://freedesktop.org/pipermail/release-wranglers/attachments/20040813/d53a3421/attachment.pgp


More information about the release-wranglers mailing list