]> granicus.if.org Git - php/commitdiff
- Fix #51671, imagefill does not work correctly for small images
authorPierre Joye <pajoye@php.net>
Wed, 28 Apr 2010 08:23:44 +0000 (08:23 +0000)
committerPierre Joye <pajoye@php.net>
Wed, 28 Apr 2010 08:23:44 +0000 (08:23 +0000)
NEWS
ext/gd/libgd/gd.c
ext/gd/tests/bug51671.phpt [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index 9aeaebcbe8ea869f9276462561476a6e2a518aa0..dbe72b7df6992762fbd99c893b43bb6e1a0fb4e1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -14,6 +14,8 @@ PHP                                                                        NEWS
 - Fixed handling of session variable serialization on certain prefix
   characters. Reported by Stefan Esser (Ilia)
 
+- Fixed bug #51671 (imagefill does not work correctly for small images).
+  (Pierre)
 - Fixed bug #51670 (getColumnMeta causes segfault when re-executing query
   after calling nextRowset). (Pierrick)
 - Fixed bug #51629 (CURLOPT_FOLLOWLOCATION error message is misleading).
index 9432f529133c1c66072c5d9b3be39f444b130a20..f7411e6397cbcfb2ef5d386241f46d9439d0294c 100644 (file)
@@ -2000,7 +2000,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;
        }
 
diff --git a/ext/gd/tests/bug51671.phpt b/ext/gd/tests/bug51671.phpt
new file mode 100644 (file)
index 0000000..5dd77fe
--- /dev/null
@@ -0,0 +1,24 @@
+--TEST--
+Bug #51671 (imagefill does not work correctly for small images)
+--SKIPIF--
+<?php
+       if(!extension_loaded('gd')){ die('skip gd extension not available'); }
+?>
+--FILE--
+<?php
+$w = 1;
+$h = 50;
+$im = imagecreatetruecolor($w, $h);
+$white = imagecolorallocate($im, 255, 255, 255);
+imagefill($im, 0, 0, $white);
+
+for ($iy = 0; $iy < $h; $iy++) {
+        if (($c = imagecolorat($im, 0, $iy)) != $white) {
+                printf("Failed, (0, $iy) is %X\n", $c);
+        }
+}
+
+echo "OK\n";
+?>
+--EXPECTF--
+OK