summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/libgd/gd.c')
-rw-r--r--ext/gd/libgd/gd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c
index e4e2e0f1a..0cc2e1d7d 100644
--- a/ext/gd/libgd/gd.c
+++ b/ext/gd/libgd/gd.c
@@ -1845,9 +1845,9 @@ void gdImageFillToBorder (gdImagePtr im, int x, int y, int border, int color)
struct seg {int y, xl, xr, dy;};
/* max depth of stack */
-#define FILL_MAX 1200000
+#define FILL_MAX ((int)(im->sy*im->sx)/4)
#define FILL_PUSH(Y, XL, XR, DY) \
- if (sp<stack+FILL_MAX*10 && Y+(DY)>=0 && Y+(DY)<wy2) \
+ if (sp<stack+FILL_MAX && Y+(DY)>=0 && Y+(DY)<wy2) \
{sp->y = Y; sp->xl = XL; sp->xr = XR; sp->dy = DY; sp++;}
#define FILL_POP(Y, XL, XR, DY) \
@@ -1889,8 +1889,8 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
}
/* Do not use the 4 neighbors implementation with
- * small images
- */
+ * small images
+ */
if (im->sx < 4) {
int ix = x, iy = y, c;
do {
@@ -1907,7 +1907,7 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc)
goto done;
}
gdImageSetPixel(im, ix, iy, nc);
- } while(ix++ < (im->sx -1));
+ } while(iy++ < (im->sy -1));
goto done;
}