Commits

Anonymous committed 5cc903a

#37, gdImageFillToBorder crashes when used with alpha

  • Participants
  • Parent commits c8e6ecd

Comments (0)

Files changed (1)

   int leftLimit, rightLimit;
   int i;
   leftLimit = (-1);
+	int restoreAlphaBleding;
+
   if (border < 0)
     {
       /* Refuse to fill to a non-solid border */
       return;
     }
+
+	restoreAlphaBleding = im->alphaBlendingFlag;
+	im->alphaBlendingFlag = 0;
+
   for (i = x; (i >= 0); i--)
     {
       if (gdImageGetPixel (im, i, y) == border)
     }
   if (leftLimit == (-1))
     {
+			im->alphaBlendingFlag = restoreAlphaBleding;
       return;
     }
   /* Seek right */
       lastBorder = 1;
       for (i = leftLimit; (i <= rightLimit); i++)
 	{
-	  int c;
-	  c = gdImageGetPixel (im, i, y + 1);
+	  int c = gdImageGetPixel (im, i, y + 1);
 	  if (lastBorder)
 	    {
 	      if ((c != border) && (c != color))
 	    }
 	}
     }
+	im->alphaBlendingFlag = restoreAlphaBleding;
 }
 
 /*