[2113] in Athena Bugs

home help back first fref pref prev next nref lref last post

Version 6.1C: VAX and RT plx X server FillStippled

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Tue Apr 25 10:52:48 1989

Date: Tue, 25 Apr 89 10:51:57 EDT
From: Jonathan I. Kamens <jik@ATHENA.MIT.EDU>
To: bugs@ATHENA.MIT.EDU, rt-testers@ATHENA.MIT.EDU, vs-testers@ATHENA.MIT.EDU,
Cc: kubitron@ATHENA.MIT.EDU, swick@ATHENA.MIT.EDU

System:

  Both VAX and RT parallax X servers, both the X11R2 and new X11R3
servers.

Synopsis of the problem:

1. Create a single-plane bitmap.
2. Make it the stipple bitmap of a GC.
3. Set the fill style of the GC to FillStippled.
4. Use the GC in an XFillRectangle call.

5. The bitmap will be corrupted by the X server.

To detect the problem:

  Use XGetGeometry on the bitmap after the XFillRectangle call.  The
bitmap will no longer have a depth of one.

Other interesting features of the bug:

  The first time you do this, the depth of the corrupted bitmap will
be (seemingly) random.  From that point on, each time you run the test
the depth of the corrupted bitmap will be incremented by 21 (really!).
It wraps around back to 1 at 255.

Test program:

  Below is a test program that causes the problem, followed by a run
on pit-manager (which works properly) and several runs on mutt (which
does not).

jik

		      *************************

#include <stdio.h>
#include <X11/Xlib.h>
#include "/usr/sipb/bitmaps.x11/sigma_pi_beta"
#define  WIDTH	100
#define  HEIGHT 100


main()
{
     Display *dpy;
     Pixmap bitmap, destination;
     Window root;
     int screen, depth;
     unsigned long black, white;
     GC gc;
     XGCValues values;
     
     dpy = XOpenDisplay((char *)NULL);
     if (! dpy)
	  error("Couldn't open display!\n");
     root = DefaultRootWindow(dpy);
     screen = DefaultScreen(dpy);
     depth = DefaultDepth(dpy, screen);
     black = BlackPixel(dpy, screen);
     white = WhitePixel(dpy, screen);
     
     bitmap = XCreateBitmapFromData(dpy, root, spb_bits, spb_width,
					     spb_height);
     if (! bitmap)
	  error("Couldn't create bitmap for stipple!\n");

     ShowDepth(dpy, bitmap);
     
     destination = XCreatePixmap(dpy, root, WIDTH, HEIGHT, depth);

     ShowDepth(dpy, bitmap);

     gc = XCreateGC(dpy, root, (unsigned long)NULL, values);

     ShowDepth(dpy, bitmap);

     XSetForeground(dpy, gc, white);
     XSetBackground(dpy, gc, black);
     XSetStipple(dpy, gc, bitmap);
     XSetFillStyle(dpy, gc, FillStippled);
     
     ShowDepth(dpy, bitmap);

     XFillRectangle(dpy, destination, gc, 0, 0, WIDTH, HEIGHT);

     ShowDepth(dpy, bitmap);

     XCloseDisplay(dpy);
     
     exit(0);
}	  


error(string)
char *string;
{
     fprintf(stderr, string);
     exit(1);
}


ShowDepth(dpy, d)
Display *dpy;
Drawable d;
{
     Window r_ret;
     int x_ret, y_ret;
     unsigned int w_ret, h_ret, bw_ret, depth_ret;

     XGetGeometry(dpy, d, &r_ret, &x_ret, &y_ret, &w_ret, &h_ret, &bw_ret,
		  &depth_ret);

     fprintf(stderr, "Depth is %d.\n", depth_ret);
}

		      *************************

ON PIT-MANAGER:

pit-manager% bugdemo
Depth is 1.
Depth is 1.
Depth is 1.
Depth is 1.
Depth is 1.
pit-manager%

ON MUTT (RT plx):

Script started on Tue Apr 25 10:45:55 1989
athena% repeat 15 bugdemo
Depth is 1.
Depth is 1.
Depth is 1.
Depth is 1.
Depth is 30.
Depth is 1.
Depth is 1.		<- notice the increment of 21
Depth is 1.
Depth is 1.
Depth is 51.
...
Depth is 72.
...
Depth is 94.
...
Depth is 116.
...
Depth is 137.
...
Depth is 158.
...
Depth is 179.
...
Depth is 200.
...
Depth is 221.
...
Depth is 242.
...			<- notice the wrap-around
Depth is 8.
...
Depth is 29.
...
Depth is 50.
...
Depth is 72.
athena% exit
script done on Tue Apr 25 10:46:17 1989

home help back first fref pref prev next nref lref last post