- MFH #38212, Segfault on invalid imagecreatefromgd2part() parameters

This commit is contained in:
Pierre Joye 2006-07-26 08:53:30 +00:00
parent 3688c103b5
commit 206ec1a06b
2 changed files with 21 additions and 0 deletions

View File

@ -430,6 +430,10 @@ gdImagePtr gdImageCreateFromGd2PartCtx (gdIOCtx * in, int srcx, int srcy, int w,
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.

View File

@ -0,0 +1,17 @@
--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