rpms/xscreensaver/devel xscreensaver-5.00-hacks-segv-sigfpv.patch, NONE, 1.1 xscreensaver.spec, 1.15, 1.16

Mamoru Tasaka (mtasaka) fedora-extras-commits at redhat.com
Thu Jun 29 16:09:24 UTC 2006


Author: mtasaka

Update of /cvs/extras/rpms/xscreensaver/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15201

Modified Files:
	xscreensaver.spec 
Added Files:
	xscreensaver-5.00-hacks-segv-sigfpv.patch 
Log Message:
* Thu Jun 29 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-10
- Fix xscreensaver-extras hacks which cause SEGV or SIGFPE.


xscreensaver-5.00-hacks-segv-sigfpv.patch:

--- NEW FILE xscreensaver-5.00-hacks-segv-sigfpv.patch ---
--- xscreensaver-5.00/hacks/attraction.c.attraction	2006-05-24 04:24:22.000000000 +0900
+++ xscreensaver-5.00/hacks/attraction.c	2006-06-29 06:33:57.000000000 +0900
@@ -729,12 +729,17 @@
 	  if(st->cbounce_p)  /* with correct bouncing */
 	    {
               /* so long as it's out of range, keep bouncing */
+	      /* limit the maximum number to bounce to 4.*/
+	      int bounce_allowed = 4;
 	
-              while( (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
+              while( bounce_allowed && (
+		     (st->balls[i].x >= (st->xlim - st->balls[i].size)) ||
                      (st->balls[i].y >= (st->ylim - st->balls[i].size)) ||
                      (st->balls[i].x <= 0) ||
                      (st->balls[i].y <= 0) )
+		     )
                 {
+                  bounce_allowed--;
                   if (st->balls[i].x >= (st->xlim - st->balls[i].size))
                     {
                       st->balls[i].x = (2*(st->xlim - st->balls[i].size) - st->balls[i].x);
--- xscreensaver-5.00/hacks/coral.c.coral	2006-03-17 08:28:00.000000000 +0900
+++ xscreensaver-5.00/hacks/coral.c	2006-06-29 15:45:58.000000000 +0900
@@ -100,12 +100,15 @@
     st->colorsloth = st->nwalkers*2/st->ncolors;
     XSetForeground(st->dpy, st->draw_gc, st->colors[st->colorindex].pixel);
 
+    if ((st->width <= 2) || (st->height <= 2)) return;
+
     for( i = 0; i < seeds; i++ ) {
         int x, y;
+	int max_repeat = 10;
         do {
           x = 1 + random() % (st->width - 2);
           y = 1 + random() % (st->height - 2);
-        } while( getdot(x, y) );
+        } while( getdot(x, y) && max_repeat--);
 
         setdot((x-1), (y-1)); setdot(x, (y-1)); setdot((x+1), (y-1));
 	setdot((x-1),  y   ); setdot(x,  y   ); setdot((x+1),  y   );
@@ -169,7 +172,8 @@
       st->nwalkers--;
       st->walkers[i].x = st->walkers[st->nwalkers].x;
       st->walkers[i].y = st->walkers[st->nwalkers].y;
-      if( 0 == (st->nwalkers%st->colorsloth) ) {
+      if( 0 == 
+	  ((st->colorsloth ? st->nwalkers%st->colorsloth : 0)) ) {
         color = True;
       }
 		  
--- xscreensaver-5.00/hacks/critical.c.critical	2006-03-22 12:41:54.000000000 +0900
+++ xscreensaver-5.00/hacks/critical.c	2006-06-29 15:22:12.000000000 +0900
@@ -289,7 +289,8 @@
      screens. */
   model_w = 80;
   st->settings.cell_size = st->wattr.width / model_w;
-  model_h = st->wattr.height / st->settings.cell_size;
+  model_h = st->settings.cell_size ?
+    st->wattr.height / st->settings.cell_size : 0;
 
   /* Construct the initial model state. */
 
--- xscreensaver-5.00/hacks/crystal.c.crystal	2006-05-24 04:28:54.000000000 +0900
+++ xscreensaver-5.00/hacks/crystal.c	2006-06-29 16:05:41.000000000 +0900
@@ -92,6 +92,9 @@
 #define DEF_MAXSIZE "False"
 #define DEF_CYCLE "True"
 
+#undef NRAND
+#define NRAND(n)           ( (n) ? (int) (LRAND() % (n)) : 0)
+
 #define min(a,b) ((a) <= (b) ? (a) : (b))
 
 static int  nx, ny;
@@ -980,9 +983,12 @@
 			cryst->offset_w = (int) (cryst->b * 0.5);
 		}
 	} else {
+		int max_repeat = 10;
 		cryst->offset_w = -1;
-		while (cryst->offset_w < 4 || (int) (cryst->offset_w - cryst->b *
-				    sin((cryst->gamma - 90) * PI_RAD)) < 4) {
+		while (max_repeat-- && 
+		  (cryst->offset_w < 4 || (int) (cryst->offset_w - cryst->b *
+				    sin((cryst->gamma - 90) * PI_RAD)) < 4)
+			   ) {
 			cryst->b = NRAND((int) (cryst->win_height / (cos((cryst->gamma - 90) *
 					    PI_RAD))) - cell_min) + cell_min;
 			if (cryst->planegroup > 8)
--- xscreensaver-5.00/hacks/eruption.c.eruption	2006-03-17 08:22:43.000000000 +0900
+++ xscreensaver-5.00/hacks/eruption.c	2006-06-29 15:19:52.000000000 +0900
@@ -116,6 +116,7 @@
 	  else if (st->particles[i].xpos >= st->iWinWidth - 2)
 	    {
 	      st->particles[i].xpos = st->iWinWidth - 2;
+	      if (st->particles[i].xpos < 1) st->particles[i].xpos = 1;
 	      st->particles[i].xdir = -st->particles[i].xdir + 4;
 	      st->particles[i].colorindex = st->iColorCount;
 	    }
@@ -129,9 +130,11 @@
 	  else if (st->particles[i].ypos >= st->iWinHeight - 3)
 	    {
 	      st->particles[i].ypos = st->iWinHeight- 3;
+	      if (st->particles[i].ypos < 1) st->particles[i].ypos = 1;
 	      st->particles[i].ydir = (-st->particles[i].ydir >> 2) - (random() % 2);
 	      st->particles[i].colorindex = st->iColorCount;
 	    }
+
 	  
 	  /* st->gravity kicks in */
 	  st->particles[i].ydir += st->gravity;
@@ -140,6 +143,7 @@
 	  st->particles[i].colorindex--;
 	  
 	  /* draw particle */
+	  if (st->iWinHeight <= 2 || st->iWinWidth <= 2) continue;
 	  st->fire[st->particles[i].ypos][st->particles[i].xpos] = st->particles[i].colorindex;
 	  st->fire[st->particles[i].ypos][st->particles[i].xpos - 1] = st->particles[i].colorindex;
 	  st->fire[st->particles[i].ypos + 1][st->particles[i].xpos] = st->particles[i].colorindex;
--- xscreensaver-5.00/hacks/fireworkx.c.fireworkx	2006-03-17 08:22:43.000000000 +0900
+++ xscreensaver-5.00/hacks/fireworkx.c	2006-06-29 14:51:34.000000000 +0900
@@ -42,7 +42,7 @@
 void mmx_glow(char *a, int b, int c, int d, char *e);
 #endif
 
-#define rnd(x) ((int)(random() % (x)))
+#define rnd(x) ((x) ? (int)(random() % (x)) : 0)
 
 typedef struct {
   unsigned int burn;
@@ -161,6 +161,7 @@
   unsigned int w = st->width;
   unsigned int h = st->height;
   unsigned char *pa, *pb, *pm, *po;
+  if (!st->xim) return;
   pm = st->palaka1;
   po = st->palaka2;
   for(n=0;n<w*4;n++) 
@@ -168,7 +169,7 @@
   pm+=n; po+=n; h-=2; 
   pa = pm-(w*4);
   pb = pm+(w*4);
-  for(n=4;n<w*h*4-4;n++){
+  for(n=4;(signed) n< (signed) (w*h*4-4); n++){
   q    = pm[n-4] + (pm[n]*8) + pm[n+4] + 
          pa[n-4] + pa[n] + pa[n+4] + 
          pb[n-4] + pb[n] + pb[n+4];
@@ -272,6 +273,7 @@
   st->palaka2 = NULL;
   st->xim = XCreateImage(st->dpy, xwa.visual, xwa.depth, ZPixmap, 0, 0,
 		     st->width, st->height, 8, 0);
+  if (!st->xim) return;
   st->palaka1 = (unsigned char *) calloc(st->xim->height+1,st->xim->width*4) + 8;
   if(st->flash_on|st->glow_on)
   st->palaka2 = (unsigned char *) calloc(st->xim->height+1,st->xim->width*4) + 8;
@@ -286,6 +288,7 @@
 {
   int x,y,i,j;
   unsigned char r, g, b;
+  if (!st->xim) return;
   i = 0;
   j = 0;
   if (st->depth==16) {
--- xscreensaver-5.00/hacks/goop.c.goop	2006-04-06 11:30:04.000000000 +0900
+++ xscreensaver-5.00/hacks/goop.c	2006-06-29 07:39:02.000000000 +0900
@@ -258,9 +258,11 @@
 
   blob_max = (width < height ? width : height) / 2;
   blob_min = (blob_max * 2) / 3;
-  for (i = 0; i < layer->nblobs; i++)
+  for (i = 0; i < layer->nblobs; i++){
+    int j = blob_max - blob_min;
     layer->blobs[i] = make_blob (dpy, width, height,
-				 (random() % (blob_max-blob_min)) + blob_min);
+				 (j ? random() % j : 0) + blob_min);
+  }
 
   layer->pixmap = XCreatePixmap (dpy, window, width, height, 1);
   layer->gc = XCreateGC (dpy, layer->pixmap, 0, &gcv);
--- xscreensaver-5.00/hacks/kaleidescope.c.kalei	2006-03-13 11:13:07.000000000 +0900
+++ xscreensaver-5.00/hacks/kaleidescope.c	2006-06-29 07:42:42.000000000 +0900
@@ -228,10 +228,10 @@
 {
 
   /* Give the segment some random values */
-  ((Ksegment *)obj->cur)->x1 = random() % g->xoff;
-  ((Ksegment *)obj->cur)->y1 = random() % g->yoff;
-  ((Ksegment *)obj->cur)->x2 = random() % g->xoff;
-  ((Ksegment *)obj->cur)->y2 = random() % g->yoff;
+  ((Ksegment *)obj->cur)->x1 = (g->xoff ? random() % g->xoff : 0);
+  ((Ksegment *)obj->cur)->y1 = (g->yoff ? random() % g->yoff : 0);
+  ((Ksegment *)obj->cur)->x2 = (g->xoff ? random() % g->xoff : 0);
+  ((Ksegment *)obj->cur)->y2 = (g->yoff ? random() % g->yoff : 0);
 }
 
 
--- xscreensaver-5.00/hacks/petri.c.petri	2006-02-26 05:13:25.000000000 +0900
+++ xscreensaver-5.00/hacks/petri.c	2006-06-29 07:30:28.000000000 +0900
@@ -121,8 +121,8 @@
 };
 
 
-#define cell_x(c) (((c) - st->arr) % st->arr_width)
-#define cell_y(c) (((c) - st->arr) / st->arr_width)
+#define cell_x(c) (st->arr_width ? ((c) - st->arr) % st->arr_width : 0)
+#define cell_y(c) (st->arr_width ? ((c) - st->arr) / st->arr_width : 0)
 
 
 static int random_life_value (struct state *st)
@@ -437,8 +437,8 @@
           }
       }
 
-    st->xSize = st->windowWidth / st->arr_width;
-    st->ySize = st->windowHeight / st->arr_height;
+    st->xSize = st->arr_width ? st->windowWidth / st->arr_width : 0;
+    st->ySize = st->arr_height ? st->windowHeight / st->arr_height : 0;
     if (st->xSize > st->ySize)
     {
 	st->xSize = st->ySize;
@@ -586,8 +586,8 @@
     
     while (n--) 
     {
-	int x = random () % st->arr_width;
-	int y = random () % st->arr_height;
+      int x = st->arr_width ? random () % st->arr_width : 0;
+      int y = st->arr_height ? random () % st->arr_height : 0;
 	int c;
 	FLOAT s;
 	if (b)
@@ -597,7 +597,7 @@
 	}
 	else
 	{
-	    c = (random () % (st->count-1)) + 1;
+	  c = ((st->count - 1) ? random () % (st->count-1) : 0) + 1;
 	    s = RAND_FLOAT * (st->maxlifespeed - st->minlifespeed) + st->minlifespeed;
 	}
 	newcell (st, &st->arr[y * st->arr_width + x], c, s);
--- xscreensaver-5.00/hacks/piecewise.c.piecewise	2006-03-08 18:57:55.000000000 +0900
+++ xscreensaver-5.00/hacks/piecewise.c	2006-06-29 07:14:50.000000000 +0900
@@ -358,7 +358,7 @@
   dr = floor(maxradius * h) - r0 + 1;
 
   for (i=0;i<n;i++) {
-    c[i].r = r0 + random() % dr;
+    c[i].r = r0 + ((dr > 0) ? random() % dr : 0);
     c[i].x = c[i].r + frand(w - 1 - 2 * c[i].r);
     c[i].y = c[i].r + frand(h - 1 - 2 * c[i].r);
     c[i].visible = random() & 1;
--- xscreensaver-5.00/hacks/popsquares.c.popsquares	2006-03-08 18:58:35.000000000 +0900
+++ xscreensaver-5.00/hacks/popsquares.c	2006-06-29 07:02:13.000000000 +0900
@@ -83,8 +83,8 @@
 
   st->sw = st->xgwa.width / st->subdivision;
   st->sh = st->xgwa.height / st->subdivision;
-  st->gw = st->xgwa.width / st->sw;
-  st->gh = st->xgwa.height / st->sh;
+  st->gw = st->sw ? st->xgwa.width / st->sw : 0;
+  st->gh = st->sh ? st->xgwa.height / st->sh : 0;
   st->nsquares = st->gw * st->gh;
 
   gcv.foreground = fg.pixel;
--- xscreensaver-5.00/hacks/ripples.c.ripples	2006-03-27 14:30:45.000000000 +0900
+++ xscreensaver-5.00/hacks/ripples.c	2006-06-29 06:59:39.000000000 +0900
@@ -757,10 +757,13 @@
   case ripple_blob: {
     double power;
 
+    int tmp_i, tmp_j;
     power = drop_dist[random() % (sizeof(drop_dist)/sizeof(drop_dist[0]))]; /* clumsy */
     dheight = (int)(drop * (power + 0.01));
-    newx = radius + border + (random() % (int)(st->width - 2*border - 2*radius*power));
-    newy = radius + border + (random() % (int)(st->height - 2*border - 2*radius*power));
+    tmp_i = (int)(st->width - 2*border - 2*radius*power);
+    tmp_j = (int)(st->height - 2*border - 2*radius*power);
+    newx = radius + border + ((tmp_i > 0) ? random() % tmp_i : 0);
+    newy = radius + border + ((tmp_j > 0) ? random() % tmp_j : 0);
     add_circle_drop(st, newx, newy, radius, dheight);
   }
   break;
@@ -770,12 +773,15 @@
     int x;
     int cx, cy;
     short *buf = (random()&1) ? st->bufferA : st->bufferB;
+    int tmp_i, tmp_j;
 
     radius = (1 + (random() % 5)) * (1 + (random() % 5));
     dheight = drop / 128;
     if (random() & 1) dheight = -dheight;
-    newx = radius + border + (random() % (st->width - 2*border - 2*radius));
-    newy = radius + border + (random() % (st->height - 2*border - 2*radius));
+    tmp_i = st->width - 2*border - 2*radius;
+    tmp_j = st->height - 2*border - 2*radius;
+    newx = radius + border + ((tmp_i > 0) ? random() % tmp_i : 0);
+    newy = radius + border + ((tmp_j > 0) ? random() % tmp_j : 0);
     x = newy * st->width + newx;
     for (cy = -radius; cy <= radius; cy++)
       for (cx = -radius; cx <= radius; cx++)


Index: xscreensaver.spec
===================================================================
RCS file: /cvs/extras/rpms/xscreensaver/devel/xscreensaver.spec,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- xscreensaver.spec	27 Jun 2006 16:18:38 -0000	1.15
+++ xscreensaver.spec	29 Jun 2006 16:09:24 -0000	1.16
@@ -1,7 +1,7 @@
 %define	name 		xscreensaver
 
 %define version		5.00
-%define fedora_rel	9
+%define fedora_rel	10
 
 %define fedora_ver	5.90
 %define default_text 	%{_datadir}/doc/fedora-release-%{fedora_ver}/eula.txt
@@ -30,6 +30,7 @@
 Patch104:	xscreensaver-5.00-xmlmanfix.patch
 Patch105:	xscreensaver-5.00-text-locale.patch
 Patch106:	xscreensaver-5.00-noseguy-cpueat.patch
+Patch107:	xscreensaver-5.00-hacks-segv-sigfpv.patch
 
 %package base
 Summary: 	A minimal installation of xscreensaver
@@ -103,6 +104,7 @@
 %patch104 -p1 -b .xmlfix
 %patch105 -p1 -b .text-locale
 %patch106 -p1 -b .noseguy-cpueat
+%patch107 -p1 -b .extras-segv-fpe
 
 install -c -m644 -p %{SOURCE10} po/ja.po
 
@@ -286,7 +288,10 @@
 %defattr(-,root,root)
 
 %changelog
-* Thu Jun 27 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-9
+* Thu Jun 29 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-10
+- Fix xscreensaver-extras hacks which cause SEGV or SIGFPE.
+
+* Tue Jun 27 2006 Mamoru Tasaka <mtasaka at ioa.s.u-tokyo.ac.jp> - 1:5.00-9
 - Don't make xscreensaver-base require htmlview.
 - Update ja.po again.
 - Fix noseguy not to eat cpu when geometry is too small.




More information about the scm-commits mailing list