Re: Flash/Mozilla/Composite bug details?

Keith Packard <[email protected]>
Newsgroups gmane.comp.freedesktop.release-wranglers
Message-ID <[email protected]>
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;

_______________________________________________
release-wranglers mailing list
[email protected]
http://freedesktop.org/mailman/listinfo/release-wranglers
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh version 2.3.1 11/28/2001

iD8DBQFBHTOZQp8BWwlsTdMRAkmiAJ9rTk6iU+M5W+t75a732yfT0WA55QCggKux
O5tn3TM+GJ/7GNvR85Vo0G0=
=GIop
-----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.