tabe Sat Mar 14 16:06:57 2009 UTC
Added files:
/php-src/ext/gd/tests bug45799.phpt
Modified files:
/php-src/ext/gd/libgd gd_png.c
Log:
Fixed bug #45799 (imagepng() crashes on empty image)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.27&r2=1.28&diff_format=u
Index: php-src/ext/gd/libgd/gd_png.c
diff -u php-src/ext/gd/libgd/gd_png.c:1.27 php-src/ext/gd/libgd/gd_png.c:1.28
--- php-src/ext/gd/libgd/gd_png.c:1.27 Wed Jan 14 10:16:42 2009
+++ php-src/ext/gd/libgd/gd_png.c Sat Mar 14 16:06:57 2009
@@ -544,6 +544,10 @@
++colors;
}
}
+ if (colors == 0) {
+ php_gd_error("gd-png error: no colors in palette");
+ goto bail;
+ }
if (colors < im->colorsTotal) {
remap = TRUE;
}
@@ -741,6 +745,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