tabe Sat Mar 14 16:08:01 2009 UTC
Added files: (Branch: PHP_5_3)
/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.965.2.509&r2=1.2027.2.547.2.965.2.510&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.965.2.509
php-src/NEWS:1.2027.2.547.2.965.2.510
--- php-src/NEWS:1.2027.2.547.2.965.2.509 Thu Mar 12 23:59:11 2009
+++ php-src/NEWS Sat Mar 14 16:07:59 2009
@@ -34,6 +34,7 @@
- Fixed bug #46048 (SimpleXML top-level @attributes not part of iterator).
(David C.)
- Fixed bug #45432 (PDO: persistent connection leak). (Felipe)
+- Fixed bug #45799 (imagepng() crashes on empty image). (Martin McNickle,
Takeshi Abe)
- Fixed bug #43831 ($this gets mangled when extending PDO with persistent
connection). (Felipe)
- Fixed PECL Bug #16035 (OCI8: oci_connect without ORACLE_HOME defined causes
segfault) (Chris Jones/Oracle Corp.)
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_png.c?r1=1.17.4.2.2.5.2.3&r2=1.17.4.2.2.5.2.4&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.5.2.3
php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.5.2.4
--- php-src/ext/gd/libgd/gd_png.c:1.17.4.2.2.5.2.3 Wed Jan 14 10:16:15 2009
+++ php-src/ext/gd/libgd/gd_png.c Sat Mar 14 16:08:00 2009
@@ -543,6 +543,10 @@
++colors;
}
}
+ if (colors == 0) {
+ php_gd_error("gd-png error: no colors in palette");
+ goto bail;
+ }
if (colors < im->colorsTotal) {
remap = TRUE;
}
@@ -740,6 +744,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