From 58a134fb48ec959ba2b2ff6d5385152cedd8a70c Mon Sep 17 00:00:00 2001 From: Florian Anderiasch Date: Tue, 1 Nov 2011 11:51:53 +0000 Subject: [PATCH] Fixed #60160 and added a test for it --- ext/gd/libgd/gd.c | 21 ++++++++------------- ext/gd/tests/bug60160.phpt | 26 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 ext/gd/tests/bug60160.phpt diff --git a/ext/gd/libgd/gd.c b/ext/gd/libgd/gd.c index 0cc2e1d7de9..fa75898ddb3 100644 --- a/ext/gd/libgd/gd.c +++ b/ext/gd/libgd/gd.c @@ -1894,19 +1894,14 @@ void gdImageFill(gdImagePtr im, int x, int y, int nc) if (im->sx < 4) { int ix = x, iy = y, c; do { - c = gdImageGetPixel(im, ix, iy); - if (c != oc) { - goto done; - } - gdImageSetPixel(im, ix, iy, nc); - } while(ix++ < (im->sx -1)); - ix = x; iy = y + 1; - do { - c = gdImageGetPixel(im, ix, iy); - if (c != oc) { - goto done; - } - gdImageSetPixel(im, ix, iy, nc); + do { + c = gdImageGetPixel(im, ix, iy); + if (c != oc) { + goto done; + } + gdImageSetPixel(im, ix, iy, nc); + } while(ix++ < (im->sx -1)); + ix = x; } while(iy++ < (im->sy -1)); goto done; } diff --git a/ext/gd/tests/bug60160.phpt b/ext/gd/tests/bug60160.phpt new file mode 100644 index 00000000000..af2df41820d --- /dev/null +++ b/ext/gd/tests/bug60160.phpt @@ -0,0 +1,26 @@ +--TEST-- +Bug #60160 (imagefill does not work correctly for small images) @see bug51671 +--SKIPIF-- + +--FILE-- + +--EXPECTF-- +OK