1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
|
Subject: Fix support large images
Origin: upstream, https://bugs.php.net/bug.php?id=51128
Bug: http://bugs.libgd.org/177
Bug-Debian: http://bugs.debian.org/595368
Last-Update: 20111015
--- a/gd.c
+++ b/gd.c
@@ -1893,9 +1893,9 @@
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) \
|