[2163] in Athena Bugs

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

X11r3 Xibm server

daemon@ATHENA.MIT.EDU (Steve Ellis)
Thu May 4 09:50:21 1989

To: bugs@ATHENA.MIT.EDU
Date: Thu, 04 May 89 09:49:48 EDT
From: Steve Ellis <ellis@ATHENA.MIT.EDU>

   Calling XDrawPoints crashes the X11r3 Xibm server when the points array is
declared size 256. The program below crashes the server when 
"#define DOT_BUFF_SIZE 256" is used. Program functions correctly
when "#define DOT_BUFF_SIZE 128" is used.

Test Program:

  /* System include files */
  
#include <stdio.h>
#include <strings.h>
  
  /* X11 include files */
  
#include <X11/Xlib.h>

static Display *dpyp;
static int bloxscreen;
static Window window;
static XSetWindowAttributes bloxwindow;
static unsigned int bloxwmask;

#define DOT_BUFF_SIZE 256
static int num_dots;
static XPoint dot_buff[DOT_BUFF_SIZE];
static XPoint *dot_buff_ptr;

/* set window size */

static int x_offset     = 0;
static int y_offset     = 0;
static int x_size       = 200;
static int y_size       = 200;
static int border_width = 4;

#define CFP CopyFromParent

  /* Graphics context related declarations */
  GC draw_gc;


static int foreground, background;	/* pixel values for drawing colors */


main(argc,argv)
  int argc;
  char *argv;
{
  XGCValues gcv;
  unsigned long gcvmask;
  char *display = NULL;
  XEvent event;
  int temp;

  if( !(dpyp = XOpenDisplay(display)) ){
    fprintf (stderr,
	     "%s in %s:  Unable to open display.\n"
	    );
    
  } 
  bloxscreen = DefaultScreen(dpyp);


  
  if (dpyp == (Display *) NULL) {
    fprintf (stderr,
	     "%s in %s:  Unable to open display.\n"
	     );
  }
    
  /* Set up master window for blox. */

  foreground = BlackPixel(dpyp,bloxscreen);
  background = WhitePixel(dpyp,bloxscreen);

  bloxwindow.background_pixel = background ;
  bloxwindow.border_pixel     = foreground ;
  bloxwmask = CWBackPixel | CWBorderPixel;
  
  
  window = XCreateWindow(dpyp, RootWindow(dpyp,bloxscreen), 
			 x_offset, y_offset, x_size, y_size,
			 border_width,CFP,CFP,CFP,
			 bloxwmask, &bloxwindow);
  
  if (!window) {
    fprintf (stderr, 
	     "%s in %s:  Error opening main window.\n"
	     );
    XCloseDisplay (dpyp);
  }
  

  /* Make the window visible on the screen. */
  XSelectInput(dpyp,window,ExposureMask);
  XMapWindow (dpyp, window);

  XMaskEvent(dpyp,ExposureMask,&event);
  /* set default graphics_context*/	

  gcv.foreground = foreground;
  gcv.background = background;
  gcv.function   = GXcopy;
  gcvmask = GCForeground | GCBackground | GCFunction;
  
  draw_gc = XCreateGC(dpyp,window,gcvmask,&gcv);

  dot_buff_ptr = dot_buff;

  temp += 50;
  vsdot(&temp,&temp);
  temp += 50;
  vsdot(&temp,&temp);
  temp += 50;
  vsdot(&temp,&temp);
  temp += 50;
  vsdot(&temp,&temp);


  vsmcur();
  sleep (10);
 
}




vsdot(x1, y1)
      int *x1;
      int *y1;
{



     dot_buff_ptr->x = *x1;
     dot_buff_ptr->y = *y1;

     num_dots++;
     dot_buff_ptr++;
  }



vsmcur()
{

  if( num_dots > 0)
   XDrawPoints (dpyp, window, draw_gc, dot_buff, num_dots,CoordModeOrigin);


  XFlush (dpyp);

  /* Reset the buffer pointers and the  counters. */
  dot_buff_ptr = dot_buff;
  num_dots = 0;
  return;
}



   

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