pajoye Sun Dec 10 02:55:30 2006 UTC
Added files: (Branch: PHP_5_2)
/php-src/ext/gd/tests bug39286.phpt
Modified files:
/php-src/ext/gd gd.c
/php-src/ext/gd/tests bug38212.phpt
Log:
- #39286, misleading error message when nvalid dimensions are given
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/gd.c?r1=1.312.2.20.2.10&r2=1.312.2.20.2.11&diff_format=u
Index: php-src/ext/gd/gd.c
diff -u php-src/ext/gd/gd.c:1.312.2.20.2.10 php-src/ext/gd/gd.c:1.312.2.20.2.11
--- php-src/ext/gd/gd.c:1.312.2.20.2.10 Sun Dec 10 01:38:01 2006
+++ php-src/ext/gd/gd.c Sun Dec 10 02:55:29 2006
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: gd.c,v 1.312.2.20.2.10 2006/12/10 01:38:01 pajoye Exp $ */
+/* $Id: gd.c,v 1.312.2.20.2.11 2006/12/10 02:55:29 pajoye Exp $ */
/* gd 1.2 is copyright 1994, 1995, Quest Protein Database Center,
Cold Spring Harbor Labs. */
@@ -2375,6 +2375,10 @@
if (argc == 5 && image_type == PHP_GDIMG_TYPE_GD2PART) {
multi_convert_to_long_ex(4, srcx, srcy, width, height);
+ if (Z_LVAL_PP(width) < 1 || Z_LVAL_PP(height) < 1) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING,"Zero width
or height not allowed");
+ RETURN_FALSE;
+ }
}
fn = Z_STRVAL_PP(file);
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug38212.phpt?r1=1.1.2.2&r2=1.1.2.3&diff_format=u
Index: php-src/ext/gd/tests/bug38212.phpt
diff -u php-src/ext/gd/tests/bug38212.phpt:1.1.2.2
php-src/ext/gd/tests/bug38212.phpt:1.1.2.3
--- php-src/ext/gd/tests/bug38212.phpt:1.1.2.2 Wed Jul 26 08:53:30 2006
+++ php-src/ext/gd/tests/bug38212.phpt Sun Dec 10 02:55:30 2006
@@ -1,5 +1,5 @@
--TEST--
-imagecopy doen't copy alpha, palette to truecolor
+Bzg #38212 (Seg Fault on invalid imagecreatefromgd2part() parameters)
--SKIPIF--
<?php
if (!function_exists('imagecopy')) die("skip gd extension not
available\n");
@@ -14,4 +14,5 @@
unlink($file);
?>
--EXPECTF--
-Warning: imagecreatefromgd2part(): '%sbug38212.gd2' is not a valid GD2 file in
%sbug38212.php on line %d
+
+Warning: imagecreatefromgd2part(): Zero width or height not allowed in %s on
line %d
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug39286.phpt?view=markup&rev=1.1
Index: php-src/ext/gd/tests/bug39286.phpt
+++ php-src/ext/gd/tests/bug39286.phpt
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php