tabe Sat Mar 14 17:48:42 2009 UTC Added files: (Branch: PHP_5_2) /php-src/ext/gd/tests bug45799.phpt
Modified files: /php-src NEWS /php-src/ext/gd/libgd gd_png.c Log: MFH: Fixed bug #45799 (imagepng() crashes on empty image) http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1437&r2=1.2027.2.547.2.1438&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.1437 php-src/NEWS:1.2027.2.547.2.1438 --- php-src/NEWS:1.2027.2.547.2.1437 Fri Mar 13 19:46:09 2009 +++ php-src/NEWS Sat Mar 14 17:48:41 2009 @@ -15,6 +15,8 @@ addresses in the filter extension). (Ilia) - Fixed bug #47430 (Errors after writing to nodeValue parameter of an absent previousSibling). (Rob) +- Fixed bug #45799 (imagepng() crashes on empty image). (Martin McNickle, + Takeshi Abe) 26 Feb 2009, PHP 5.2.9 - Changed __call() to be invoked on private/protected method access, similar to http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.17.4.2.2.6&r2=1.17.4.2.2.7&diff_format=u Index: php-src/ext/gd/libgd/gd_png.c diff -u php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.6 php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.7 --- php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.6 Thu Jul 31 09:22:17 2008 +++ php-src/ext/gd/libgd/gd_png.c Sat Mar 14 17:48:42 2009 @@ -535,6 +535,10 @@ ++colors; } } + if (colors == 0) { + php_gd_error("gd-png error: no colors in palette"); + goto bail; + } if (colors < im->colorsTotal) { remap = TRUE; } @@ -732,6 +736,7 @@ } } /* 1.6.3: maybe we should give that memory BACK! TBB */ + bail: png_destroy_write_struct(&png_ptr, &info_ptr); } http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug45799.phpt?view=markup&rev=1.1 Index: php-src/ext/gd/tests/bug45799.phpt +++ php-src/ext/gd/tests/bug45799.phpt --TEST-- Bug #45799 (imagepng() crashes on empty image). --SKIPIF-- <?php if (!extension_loaded('gd')) die("skip gd extension not available\n"); ?> --FILE-- <?php $img = imagecreate(500,500); imagepng($img); imagedestroy($img); ?> --EXPECTF-- Warning: imagepng(): gd-png error: no colors in palette in %s on line %d -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php