Commits

Anonymous committed 30a36c2

#23, Added sanity checks for possible allocation failures in
gdImageFilledPolygon and gdImageSetStyle
#24, Out of range checks in gdImageSetAAPixelColor

  • Participants
  • Parent commits 677d728

Comments (0)

Files changed (2)

 #20, Fixed gdImageCopyMergeGray when used with a true color image
 #21, gdImageCopyResized sanity check for allocation failures
 #22, Fixed transparency preservation in gdImageCopyRotated 
+#23,  Added sanity checks  for possible allocation failures in 
+      gdImageFilledPolygon and gdImageSetStyle
+#24,  Out of range checks in gdImageSetAAPixelColor
         return;
       }
       im->polyInts = (int *) gdMalloc (sizeof (int) * n);
+			if (!im->polyInts) {
+				return;
+			}
       im->polyAllocated = n;
     }
   if (im->polyAllocated < n)
       }
       im->polyInts = (int *) gdRealloc (im->polyInts,
 					sizeof (int) * im->polyAllocated);
+			if (!im->polyInts) {
+				return;
+			}
     }
   miny = p[0].y;
   maxy = p[0].y;
     return;
   }   	
   im->style = (int *) gdMalloc (sizeof (int) * noOfPixels);
+	if (!im->style) {
+		return;
+	}
   memcpy (im->style, style, sizeof (int) * noOfPixels);
   im->styleLength = noOfPixels;
   im->stylePos = 0;
 static void gdImageSetAAPixelColor(gdImagePtr im, int x, int y, int color, int t)
 {
 	int dr,dg,db,p,r,g,b;
+
+	/* 2.0.34: watch out for out of range calls */
+	if (!gdImageBoundsSafeMacro(im, x, y)) {
+		return;
+	}
 	p = gdImageGetPixel(im,x,y);
         /* TBB: we have to implement the dont_blend stuff to provide
           the full feature set of the old implementation */