pajoye          Thu Sep 28 08:52:24 2006 UTC

  Modified files:              
    /php-src/ext/gd/libgd       gd.c 
    /php-src/ext/gd/tests       imagefill_1.phpt 
  Log:
  - MFB: imagefill(), infinite loop with wrong color index
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd.c?r1=1.94&r2=1.95&diff_format=u
Index: php-src/ext/gd/libgd/gd.c
diff -u php-src/ext/gd/libgd/gd.c:1.94 php-src/ext/gd/libgd/gd.c:1.95
--- php-src/ext/gd/libgd/gd.c:1.94      Sun Jul 23 21:48:18 2006
+++ php-src/ext/gd/libgd/gd.c   Thu Sep 28 08:52:23 2006
@@ -1914,6 +1914,10 @@
        struct seg *stack;
        struct seg *sp;
 
+       if (!im->trueColor && nc > (im->colorsTotal -1)) {
+               return;
+       }
+
        alphablending_bak = im->alphaBlendingFlag;      
        im->alphaBlendingFlag = 0;
 
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/imagefill_1.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/gd/tests/imagefill_1.phpt
diff -u /dev/null php-src/ext/gd/tests/imagefill_1.phpt:1.2
--- /dev/null   Thu Sep 28 08:52:24 2006
+++ php-src/ext/gd/tests/imagefill_1.phpt       Thu Sep 28 08:52:23 2006
@@ -0,0 +1,25 @@
+--TEST--
+imagefill() infinite loop with wrong color index
+--SKIPIF--
+<?php 
+       if (!extension_loaded('gd')) {
+               die("skip gd extension not available.");
+       }
+       if (!function_exists("imagefttext")) {
+               die("skip imagefttext() not available.");
+       }
+?>
+--FILE--
+<?php
+$im = imagecreate(100,100);
+$white = imagecolorallocate($im, 255,255,255);
+$blue = imagecolorallocate($im, 0,0,255);
+$green = imagecolorallocate($im, 0,255,0);
+
+print_r(imagecolorat($im, 0,0));
+imagefill($im, 0,0,$white + 3);
+print_r(imagecolorat($im, 0,0));
+imagedestroy($im);
+?>
+--EXPECT--
+00

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to