pajoye Wed Jul 26 08:51:53 2006 UTC
Added files:
/php-src/ext/gd/tests bug38212.phpt
Modified files:
/php-src/ext/gd/libgd gd_gd2.c
Log:
- #38212, Segfault on invalid imagecreatefromgd2part() parameters
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/libgd/gd_gd2.c?r1=1.17&r2=1.18&diff_format=u
Index: php-src/ext/gd/libgd/gd_gd2.c
diff -u php-src/ext/gd/libgd/gd_gd2.c:1.17 php-src/ext/gd/libgd/gd_gd2.c:1.18
--- php-src/ext/gd/libgd/gd_gd2.c:1.17 Thu Aug 18 12:54:29 2005
+++ php-src/ext/gd/libgd/gd_gd2.c Wed Jul 26 08:51:53 2006
@@ -430,6 +430,10 @@
gdImagePtr im;
+ if (w<1 || h <1) {
+ return 0;
+ }
+
/* The next few lines are basically copied from gd2CreateFromFile
* we change the file size, so don't want to use the code directly.
* but we do need to know the file size.
http://cvs.php.net/viewvc.cgi/php-src/ext/gd/tests/bug38212.phpt?view=markup&rev=1.1
Index: php-src/ext/gd/tests/bug38212.phpt
+++ php-src/ext/gd/tests/bug38212.phpt
--TEST--
imagecopy doen't copy alpha, palette to truecolor
--SKIPIF--
<?php
if (!function_exists('imagecopy')) die("skip gd extension not
available\n");
?>
--FILE--
<?php
$file = dirname(__FILE__) . '/bug38212.gd2';
$im1 = imagecreatetruecolor(10,100);
imagefill($im1, 0,0, 0xffffff);
imagegd2($im1, $file);
$im = imagecreatefromgd2part($file, 0,0, -25,10);
unlink($file);
?>
--EXPECTF--
Warning: imagecreatefromgd2part(): '%sbug38212.gd2' is not a valid GD2 file in
%sbug38212.php on line %d
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php