summaryrefslogtreecommitdiff
path: root/ext/gd/tests
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/tests')
-rw-r--r--ext/gd/tests/bug19366.phpt5
-rw-r--r--ext/gd/tests/bug22544.phpt9
-rw-r--r--ext/gd/tests/bug24155.phpt10
-rw-r--r--ext/gd/tests/bug24594.phpt5
-rw-r--r--ext/gd/tests/bug27582_1.phpt1
-rw-r--r--ext/gd/tests/bug28147.phpt12
-rw-r--r--ext/gd/tests/bug36697.phpt7
-rw-r--r--ext/gd/tests/bug37346.phpt5
-rw-r--r--ext/gd/tests/bug37360.phpt5
-rw-r--r--ext/gd/tests/bug38112.phpt7
-rw-r--r--ext/gd/tests/bug39082.phpt7
-rw-r--r--ext/gd/tests/bug39273.phpt5
-rw-r--r--ext/gd/tests/bug39286.phpt5
-rw-r--r--ext/gd/tests/bug39366.phpt6
-rw-r--r--ext/gd/tests/bug39508.phpt5
-rw-r--r--ext/gd/tests/bug39780.phpt8
-rw-r--r--ext/gd/tests/bug39780_extern.phpt18
-rw-r--r--ext/gd/tests/createfromgd2.phpt1
-rw-r--r--ext/gd/tests/createfromwbmp.phpt1
-rw-r--r--ext/gd/tests/createfromwbmp2.phpt3
-rw-r--r--ext/gd/tests/createfromwbmp2_extern.phpt47
-rw-r--r--ext/gd/tests/gif2gd.phpt10
-rw-r--r--ext/gd/tests/gif2jpg.phpt8
-rw-r--r--ext/gd/tests/gif2png.phpt8
-rw-r--r--ext/gd/tests/imagefilter.phpt24
-rw-r--r--ext/gd/tests/imagewbmp.phpt1
-rw-r--r--ext/gd/tests/jpeg2png.phpt14
-rw-r--r--ext/gd/tests/jpg2gd.phpt14
-rw-r--r--ext/gd/tests/libgd00086.phpt6
-rw-r--r--ext/gd/tests/libgd00086_extern.phpt19
-rw-r--r--ext/gd/tests/libgd00094.phpt19
-rw-r--r--ext/gd/tests/libgd00094.xbm3
-rw-r--r--ext/gd/tests/libgd00101.gd1
-rw-r--r--ext/gd/tests/libgd00101.phpt18
-rw-r--r--ext/gd/tests/libgd00106.phpt22
-rw-r--r--ext/gd/tests/png2gd.phpt14
-rw-r--r--ext/gd/tests/pngcomp.phpt8
-rw-r--r--ext/gd/tests/xpm2gd.phpt10
-rw-r--r--ext/gd/tests/xpm2jpg.phpt8
-rw-r--r--ext/gd/tests/xpm2png.phpt8
40 files changed, 243 insertions, 144 deletions
diff --git a/ext/gd/tests/bug19366.phpt b/ext/gd/tests/bug19366.phpt
index c83d816c1..2832f7264 100644
--- a/ext/gd/tests/bug19366.phpt
+++ b/ext/gd/tests/bug19366.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #19366 (gdimagefill() function crashes (fixed in bundled libgd))
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug22544.phpt b/ext/gd/tests/bug22544.phpt
index 3c21f0b3c..4c8f763a7 100644
--- a/ext/gd/tests/bug22544.phpt
+++ b/ext/gd/tests/bug22544.phpt
@@ -1,13 +1,10 @@
--TEST--
Bug #22544 (TrueColor transparency in PNG images).
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
+<?php
+ if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
?>
--FILE--
<?php
@@ -19,7 +16,7 @@ Bug #22544 (TrueColor transparency in PNG images).
imageColorTransparent($image, $transparent);
imageFilledRectangle($image, 0, 0, 640-1, 100-1, $transparent);
imagePng($image, $dest);
- echo md5_file($dest) . "\n";
+ echo md5_file($dest) . "\n";
@unlink($dest);
?>
--EXPECT--
diff --git a/ext/gd/tests/bug24155.phpt b/ext/gd/tests/bug24155.phpt
index a7cf9ef73..43d34b717 100644
--- a/ext/gd/tests/bug24155.phpt
+++ b/ext/gd/tests/bug24155.phpt
@@ -1,13 +1,11 @@
--TEST--
Bug #24155 (gdImageRotate270 rotation problem).
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
+<?php
+ if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
+ if (!function_exists("imagerotate")) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
@@ -15,7 +13,7 @@ Bug #24155 (gdImageRotate270 rotation problem).
@unlink($dest);
$im = imagecreatetruecolor(30, 50);
- imagefill($im, 0, 0, (16777215 - 255));
+ imagefill($im, 0, 0, (16777215 - 255));
$im = imagerotate($im, 270, 255);
imagepng($im, $dest);
diff --git a/ext/gd/tests/bug24594.phpt b/ext/gd/tests/bug24594.phpt
index e7b9a653f..f4006497c 100644
--- a/ext/gd/tests/bug24594.phpt
+++ b/ext/gd/tests/bug24594.phpt
@@ -5,9 +5,6 @@ Bug #24594 (Filling an area using tiles).
if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
?>
--FILE--
<?php
@@ -82,4 +79,4 @@ Bug #24594 (Filling an area using tiles).
?>
--EXPECT--
000000111111101010
-111111111111111111
+111111111111111111
diff --git a/ext/gd/tests/bug27582_1.phpt b/ext/gd/tests/bug27582_1.phpt
index b85f7457e..28db15a74 100644
--- a/ext/gd/tests/bug27582_1.phpt
+++ b/ext/gd/tests/bug27582_1.phpt
@@ -3,7 +3,6 @@ Bug #27582 (ImageFillToBorder() on alphablending image looses alpha on fill colo
--SKIPIF--
<?php
if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug28147.phpt b/ext/gd/tests/bug28147.phpt
index b3551a639..de5c9022a 100644
--- a/ext/gd/tests/bug28147.phpt
+++ b/ext/gd/tests/bug28147.phpt
@@ -1,9 +1,9 @@
--TEST--
Bug #28147 (Crash with anti-aliased line)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!function_exists("imageantialias")) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
@@ -13,12 +13,12 @@ Bug #28147 (Crash with anti-aliased line)
$im = imagecreatetruecolor(300, 300);
$w = imagecolorallocate($im, 255, 255, 255);
$red = imagecolorallocate($im, 255, 0, 0);
-
+
imagefilledrectangle($im,0,0,299,299,$w);
-
+
imageantialias($im,true);
imageline($im, 299, 299, 0, 299, $red);
-
+
imagedestroy($im);
echo "Alive\n";
diff --git a/ext/gd/tests/bug36697.phpt b/ext/gd/tests/bug36697.phpt
index b257f63e2..9335e5f58 100644
--- a/ext/gd/tests/bug36697.phpt
+++ b/ext/gd/tests/bug36697.phpt
@@ -1,13 +1,10 @@
--TEST--
Bug #36697 (TrueColor transparency with GIF palette output).
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
+<?php
+ if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug37346.phpt b/ext/gd/tests/bug37346.phpt
index 859518e1f..36d9c0a04 100644
--- a/ext/gd/tests/bug37346.phpt
+++ b/ext/gd/tests/bug37346.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #37346 (gdimagecreatefromgif, bad colormap)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug37360.phpt b/ext/gd/tests/bug37360.phpt
index 4b377ade8..44bbd96b8 100644
--- a/ext/gd/tests/bug37360.phpt
+++ b/ext/gd/tests/bug37360.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #37360 (gdimagecreatefromgif, bad image sizes)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug38112.phpt b/ext/gd/tests/bug38112.phpt
index 6c5227124..0e4b8afd3 100644
--- a/ext/gd/tests/bug38112.phpt
+++ b/ext/gd/tests/bug38112.phpt
@@ -1,13 +1,10 @@
--TEST--
Bug #38112 (GIF Invalid Code size ).
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
+<?php
+ if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39082.phpt b/ext/gd/tests/bug39082.phpt
index 9bbfdb2e3..9bd6f5edc 100644
--- a/ext/gd/tests/bug39082.phpt
+++ b/ext/gd/tests/bug39082.phpt
@@ -1,13 +1,10 @@
--TEST--
Bug #39082 (Output image to stdout segfaults).
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) {
+<?php
+ if (!extension_loaded('gd')) {
die("skip gd extension not available\n");
}
- if (!GD_BUNDLED) {
- die('skip external GD libraries may fail');
- }
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39273.phpt b/ext/gd/tests/bug39273.phpt
index 438450044..9867b7469 100644
--- a/ext/gd/tests/bug39273.phpt
+++ b/ext/gd/tests/bug39273.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #37360 (gdimagecreatefromgif, bad image sizes)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39286.phpt b/ext/gd/tests/bug39286.phpt
index 3f2a17812..9171fb7f0 100644
--- a/ext/gd/tests/bug39286.phpt
+++ b/ext/gd/tests/bug39286.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #39508 (imagefill crashes with small images 3 pixels or less)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39366.phpt b/ext/gd/tests/bug39366.phpt
index 212012a1b..f80564565 100644
--- a/ext/gd/tests/bug39366.phpt
+++ b/ext/gd/tests/bug39366.phpt
@@ -1,9 +1,9 @@
--TEST--
Bug #39366 (imagerotate does not respect alpha with angles>45)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!function_exists("imagerotate")) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39508.phpt b/ext/gd/tests/bug39508.phpt
index 9e86efc20..791c59c23 100644
--- a/ext/gd/tests/bug39508.phpt
+++ b/ext/gd/tests/bug39508.phpt
@@ -1,9 +1,8 @@
--TEST--
Bug #39508 (imagefill crashes with small images 3 pixels or less)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/bug39780.phpt b/ext/gd/tests/bug39780.phpt
index efa092bfb..964cf6953 100644
--- a/ext/gd/tests/bug39780.phpt
+++ b/ext/gd/tests/bug39780.phpt
@@ -1,9 +1,9 @@
--TEST--
Bug #39780 (PNG image with CRC/data error raises a fatal error)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
@@ -17,5 +17,5 @@ Warning: imagecreatefrompng(): gd-png: fatal libpng error: Read Error: truncate
Warning: imagecreatefrompng(): gd-png error: setjmp returns error condition in %s on line %d
-Warning: imagecreatefrompng(): '%sbug39780.png' is not a valid PNG file in %s on line %d
+Warning: imagecreatefrompng(): '%s' is not a valid PNG file in %s on line %d
bool(false)
diff --git a/ext/gd/tests/bug39780_extern.phpt b/ext/gd/tests/bug39780_extern.phpt
new file mode 100644
index 000000000..79ed4f2cf
--- /dev/null
+++ b/ext/gd/tests/bug39780_extern.phpt
@@ -0,0 +1,18 @@
+--TEST--
+Bug #39780 (PNG image with CRC/data error raises a fatal error)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (GD_BUNDLED) die("skip requires extern GD\n");
+?>
+--FILE--
+<?php
+
+$im = imagecreatefrompng(dirname(__FILE__) . '/bug39780.png');
+var_dump($im);
+?>
+--EXPECTF--
+gd-png: fatal libpng error: Read Error: truncated data
+gd-png error: setjmp returns error condition 2
+Warning: imagecreatefrompng(): '%sbug39780.png' is not a valid PNG file in /%s on line %d
+bool(false) \ No newline at end of file
diff --git a/ext/gd/tests/createfromgd2.phpt b/ext/gd/tests/createfromgd2.phpt
index 98b078ea5..e43d1b865 100644
--- a/ext/gd/tests/createfromgd2.phpt
+++ b/ext/gd/tests/createfromgd2.phpt
@@ -3,7 +3,6 @@ imagecreatefromgd2
--SKIPIF--
<?php
if (!function_exists('imagecreatefromgd2')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
?>
--FILE--
<?php
diff --git a/ext/gd/tests/createfromwbmp.phpt b/ext/gd/tests/createfromwbmp.phpt
index 5e48f235e..589bbaf85 100644
--- a/ext/gd/tests/createfromwbmp.phpt
+++ b/ext/gd/tests/createfromwbmp.phpt
@@ -3,7 +3,6 @@ imagecreatefromwbmp
--SKIPIF--
<?php
if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
?>
--FILE--
<?php
diff --git a/ext/gd/tests/createfromwbmp2.phpt b/ext/gd/tests/createfromwbmp2.phpt
index 88c39b02a..9e7ef12da 100644
--- a/ext/gd/tests/createfromwbmp2.phpt
+++ b/ext/gd/tests/createfromwbmp2.phpt
@@ -3,6 +3,7 @@ imagecreatefromwbmp with invalid wbmp
--SKIPIF--
<?php
if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
@@ -44,4 +45,4 @@ unlink($filename);
Warning: imagecreatefromwbmp(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
in %s on line %d
-Warning: imagecreatefromwbmp(): '%s' is not a valid WBMP file in %s on line %d
+Warning: imagecreatefromwbmp(): '%s' is not a valid WBMP file in %s on line %d
diff --git a/ext/gd/tests/createfromwbmp2_extern.phpt b/ext/gd/tests/createfromwbmp2_extern.phpt
new file mode 100644
index 000000000..7be46f78f
--- /dev/null
+++ b/ext/gd/tests/createfromwbmp2_extern.phpt
@@ -0,0 +1,47 @@
+--TEST--
+imagecreatefromwbmp with invalid wbmp
+--SKIPIF--
+<?php
+ if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n");
+ if (GD_BUNDLED) die("skip requires extern GD\n");
+?>
+--FILE--
+<?php
+$filename = dirname(__FILE__) . '/_tmp.wbmp';
+$fp = fopen($filename,"wb");
+if (!$fp) {
+ exit("Failed to create <$filename>");
+}
+
+//write header
+$c = 0;
+fputs($fp, chr($c), 1);
+fputs($fp, $c, 1);
+
+//write width = 2^32 / 4 + 1
+$c = 0x84;
+fputs($fp, chr($c), 1);
+$c = 0x80;
+fputs($fp, chr($c), 1);
+fputs($fp, chr($c), 1);
+fputs($fp, chr($c), 1);
+$c = 0x01;
+fputs($fp, chr($c), 1);
+
+/*write height = 4*/
+$c = 0x04;
+fputs($fp, chr($c), 1);
+
+/*write some data to cause overflow*/
+for ($i=0; $i<10000; $i++) {
+ fwrite($fp, chr($c), 1);
+}
+
+fclose($fp);
+$im = imagecreatefromwbmp($filename);
+unlink($filename);
+?>
+--EXPECTF--
+gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+
+Warning: imagecreatefromwbmp(): '%s_tmp.wbmp' is not a valid WBMP file in %s on line %d
diff --git a/ext/gd/tests/gif2gd.phpt b/ext/gd/tests/gif2gd.phpt
index 75291777d..17ec158cb 100644
--- a/ext/gd/tests/gif2gd.phpt
+++ b/ext/gd/tests/gif2gd.phpt
@@ -1,13 +1,11 @@
--TEST--
gif --> gd1/gd2 conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefromgif")) {
die("skip gif read support unavailable");
}
@@ -19,11 +17,11 @@ gif --> gd1/gd2 conversion test
echo "GIF to GD1 conversion: ";
echo imagegd(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
-
+
echo "GIF to GD2 conversion: ";
echo imagegd2(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
?>
diff --git a/ext/gd/tests/gif2jpg.phpt b/ext/gd/tests/gif2jpg.phpt
index efea3525c..5f32c3596 100644
--- a/ext/gd/tests/gif2jpg.phpt
+++ b/ext/gd/tests/gif2jpg.phpt
@@ -1,13 +1,11 @@
--TEST--
gif --> jpeg conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagejpeg")) {
die("skip jpeg support unavailable");
}
@@ -22,7 +20,7 @@ gif --> jpeg conversion test
echo "GIF to JPEG conversion: ";
echo imagejpeg(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test_gif.jpeg");
?>
--EXPECT--
diff --git a/ext/gd/tests/gif2png.phpt b/ext/gd/tests/gif2png.phpt
index 6ac99bb22..3b8beca24 100644
--- a/ext/gd/tests/gif2png.phpt
+++ b/ext/gd/tests/gif2png.phpt
@@ -1,13 +1,11 @@
--TEST--
gif --> png conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagepng")) {
die("skip png support unavailable");
}
@@ -22,7 +20,7 @@ gif --> png conversion test
echo "GIF to PNG conversion: ";
echo imagepng(imagecreatefromgif($cwd . "/conv_test.gif"), $cwd . "/test_gif.png") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test_gif.png");
?>
--EXPECT--
diff --git a/ext/gd/tests/imagefilter.phpt b/ext/gd/tests/imagefilter.phpt
index 9857b53a0..b3855d66f 100644
--- a/ext/gd/tests/imagefilter.phpt
+++ b/ext/gd/tests/imagefilter.phpt
@@ -1,13 +1,11 @@
--TEST--
imagefilter() function test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip this test requires bundled gd library.");
- }
+ if (!function_exists("imagefilter")) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
@@ -15,7 +13,7 @@ $no_arg_filters = array(
"IMG_FILTER_NEGATE",
"IMG_FILTER_GRAYSCALE",
"IMG_FILTER_EDGEDETECT",
- "IMG_FILTER_GAUSSIAN_BLUR",
+ "IMG_FILTER_GAUSSIAN_BLUR",
"IMG_FILTER_SELECTIVE_BLUR",
"IMG_FILTER_EMBOSS",
"IMG_FILTER_MEAN_REMOVAL"
@@ -23,7 +21,7 @@ $no_arg_filters = array(
$SAVE_DIR = dirname(__FILE__);
$SOURCE_IMG = $SAVE_DIR . "/test.png";
-
+
foreach ($no_arg_filters as $filt) {
$im = imagecreatefrompng($SOURCE_IMG);
if (imagefilter($im, constant($filt))) {
@@ -33,10 +31,10 @@ $SOURCE_IMG = $SAVE_DIR . "/test.png";
} else {
echo "$filt failed\n";
}
- }
+ }
$im = imagecreatefrompng($SOURCE_IMG);
-
+
if (imagefilter($im, IMG_FILTER_SMOOTH, -1924.124)) {
imagepng($im, $SAVE_DIR . "/IMG_FILTER_SMOOTH.png");
echo "IMG_FILTER_SMOOTH success\n";
@@ -44,9 +42,9 @@ $SOURCE_IMG = $SAVE_DIR . "/test.png";
} else {
echo "IMG_FILTER_SMOOTH failed\n";
}
-
+
$im = imagecreatefrompng($SOURCE_IMG);
-
+
if (imagefilter($im, IMG_FILTER_COLORIZE, -127.12, -127.98, 127)) {
imagepng($im, $SAVE_DIR . "/IMG_FILTER_COLORIZE.png");
echo "IMG_FILTER_COLORIZE success\n";
@@ -54,9 +52,9 @@ $SOURCE_IMG = $SAVE_DIR . "/test.png";
} else {
echo "IMG_FILTER_COLORIZE failed\n";
}
-
+
$im = imagecreatefrompng($SOURCE_IMG);
-
+
if (imagefilter($im, IMG_FILTER_CONTRAST, -90)) {
imagepng($im, $SAVE_DIR . "/IMG_FILTER_CONTRAST.png");
echo "IMG_FILTER_CONTRAST success\n";
@@ -66,7 +64,7 @@ $SOURCE_IMG = $SAVE_DIR . "/test.png";
}
$im = imagecreatefrompng($SOURCE_IMG);
-
+
if (imagefilter($im, IMG_FILTER_BRIGHTNESS, 98)) {
imagepng($im, $SAVE_DIR . "/IMG_FILTER_BRIGHTNESS.png");
echo "IMG_FILTER_BRIGHTNESS success\n";
diff --git a/ext/gd/tests/imagewbmp.phpt b/ext/gd/tests/imagewbmp.phpt
index cea464e75..a10dbdb5f 100644
--- a/ext/gd/tests/imagewbmp.phpt
+++ b/ext/gd/tests/imagewbmp.phpt
@@ -3,7 +3,6 @@ imagewbmp
--SKIPIF--
<?php
if (!function_exists('imagecreatefromwbmp')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
?>
--FILE--
<?php
diff --git a/ext/gd/tests/jpeg2png.phpt b/ext/gd/tests/jpeg2png.phpt
index c86cb4fe4..0a170eeee 100644
--- a/ext/gd/tests/jpeg2png.phpt
+++ b/ext/gd/tests/jpeg2png.phpt
@@ -1,13 +1,11 @@
--TEST--
jpeg <--> png conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
die("skip png support unavailable");
}
@@ -22,19 +20,19 @@ jpeg <--> png conversion test
echo "PNG to JPEG conversion: ";
echo imagejpeg(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test_jpeg.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
echo "Generated JPEG to PNG conversion: ";
echo imagepng(imagecreatefromjpeg($cwd . "/test_jpeg.jpeg"), $cwd . "/test_jpng.png") ? 'ok' : 'failed';
echo "\n";
-
+
echo "JPEG to PNG conversion: ";
echo imagepng(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test_png.png") ? 'ok' : 'failed';
echo "\n";
-
+
echo "Generated PNG to JPEG conversion: ";
echo imagejpeg(imagecreatefrompng($cwd . "/test_png.png"), $cwd . "/test_pjpeg.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test_jpeg.jpeg");
@unlink($cwd . "/test_jpng.png");
@unlink($cwd . "/test_png.png");
diff --git a/ext/gd/tests/jpg2gd.phpt b/ext/gd/tests/jpg2gd.phpt
index 24d1940fa..805ec7983 100644
--- a/ext/gd/tests/jpg2gd.phpt
+++ b/ext/gd/tests/jpg2gd.phpt
@@ -1,13 +1,11 @@
--TEST--
jpeg <--> gd1/gd2 conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefromjpeg") || !function_exists("imagejpeg")) {
die("skip jpeg support unavailable");
}
@@ -19,19 +17,19 @@ jpeg <--> gd1/gd2 conversion test
echo "JPEG to GD1 conversion: ";
echo imagegd(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
-
+
echo "JPEG to GD2 conversion: ";
echo imagegd2(imagecreatefromjpeg($cwd . "/conv_test.jpeg"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
-
+
echo "GD1 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
echo "GD2 to JPEG conversion: ";
echo imagejpeg(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
@unlink($cwd . "/test_gd1.jpeg");
diff --git a/ext/gd/tests/libgd00086.phpt b/ext/gd/tests/libgd00086.phpt
index 60f28107c..4c909343c 100644
--- a/ext/gd/tests/libgd00086.phpt
+++ b/ext/gd/tests/libgd00086.phpt
@@ -1,9 +1,9 @@
--TEST--
libgd #86 (Possible infinite loop in imagecreatefrompng)
--SKIPIF--
-<?php
- if (!extension_loaded('gd')) die("skip gd extension not available\n");
- if (!GD_BUNDLED) die('skip external GD libraries always fail');
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
?>
--FILE--
<?php
diff --git a/ext/gd/tests/libgd00086_extern.phpt b/ext/gd/tests/libgd00086_extern.phpt
new file mode 100644
index 000000000..0c8d18092
--- /dev/null
+++ b/ext/gd/tests/libgd00086_extern.phpt
@@ -0,0 +1,19 @@
+--TEST--
+libgd #86 (Possible infinite loop in imagecreatefrompng)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (GD_BUNDLED) die("skip requires external GD library\n");
+?>
+--FILE--
+<?php
+
+$im = imagecreatefrompng(dirname(__FILE__) . '/libgd00086.png');
+var_dump($im);
+?>
+--EXPECTF--
+gd-png: fatal libpng error: Read Error: truncated data
+gd-png error: setjmp returns error condition 1
+
+Warning: imagecreatefrompng(): '%slibgd00086.png' is not a valid PNG file in %s on line %d
+bool(false)
diff --git a/ext/gd/tests/libgd00094.phpt b/ext/gd/tests/libgd00094.phpt
new file mode 100644
index 000000000..d1d68eab0
--- /dev/null
+++ b/ext/gd/tests/libgd00094.phpt
@@ -0,0 +1,19 @@
+--TEST--
+libgd #94 (imagecreatefromxbm can crash if gdImageCreate fails)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
+?>
+--FILE--
+<?php
+$im = imagecreatefromxbm(dirname(__FILE__) . '/libgd00094.xbm');
+var_dump($im);
+?>
+--EXPECTF--
+Warning: imagecreatefromxbm(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ in %slibgd00094.php on line %d
+
+Warning: imagecreatefromxbm(): '%slibgd00094.xbm' is not a valid XBM file in %slibgd00094.php on line %d
+bool(false)
+
diff --git a/ext/gd/tests/libgd00094.xbm b/ext/gd/tests/libgd00094.xbm
new file mode 100644
index 000000000..4d0f5bdd8
--- /dev/null
+++ b/ext/gd/tests/libgd00094.xbm
@@ -0,0 +1,3 @@
+#define width 255
+#define height 1073741824
+static unsigned char bla = {
diff --git a/ext/gd/tests/libgd00101.gd b/ext/gd/tests/libgd00101.gd
new file mode 100644
index 000000000..5516ce09c
--- /dev/null
+++ b/ext/gd/tests/libgd00101.gd
@@ -0,0 +1 @@
+ÿýÿý \ No newline at end of file
diff --git a/ext/gd/tests/libgd00101.phpt b/ext/gd/tests/libgd00101.phpt
new file mode 100644
index 000000000..1c6623d2e
--- /dev/null
+++ b/ext/gd/tests/libgd00101.phpt
@@ -0,0 +1,18 @@
+--TEST--
+libgd #101 (imagecreatefromgd can crash if gdImageCreate fails)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+ if (!GD_BUNDLED) die("skip requires bundled GD library\n");
+?>
+--FILE--
+<?php
+$im = imagecreatefromgd(dirname(__FILE__) . '/libgd00101.gd');
+var_dump($im);
+?>
+--EXPECTF--
+Warning: imagecreatefromgd(): gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully
+ in %slibgd00101.php on line %d
+
+Warning: imagecreatefromgd(): '%slibgd00101.gd' is not a valid GD file in %slibgd00101.php on line %d
+bool(false)
diff --git a/ext/gd/tests/libgd00106.phpt b/ext/gd/tests/libgd00106.phpt
new file mode 100644
index 000000000..65e4692ea
--- /dev/null
+++ b/ext/gd/tests/libgd00106.phpt
@@ -0,0 +1,22 @@
+--TEST--
+libgd #106 (imagerectangle 1x1 draws 1x3)
+--SKIPIF--
+<?php
+ if (!extension_loaded('gd')) die("skip gd extension not available\n");
+?>
+--FILE--
+<?php
+$im = imagecreatetruecolor(10,10);
+imagerectangle($im, 1,1, 1,1, 0xFFFFFF);
+$c1 = imagecolorat($im, 1,1);
+$c2 = imagecolorat($im, 1,2);
+$c3 = imagecolorat($im, 2,1);
+$c4 = imagecolorat($im, 2,2);
+if ($c1 == 0xFFFFFF && $c2 == 0 && $c3 == 0 && $c4 == 0) {
+ echo "Ok";
+} else {
+ echo "failed";
+}
+?>
+--EXPECT--
+Ok
diff --git a/ext/gd/tests/png2gd.phpt b/ext/gd/tests/png2gd.phpt
index d74e888d6..65ca505ae 100644
--- a/ext/gd/tests/png2gd.phpt
+++ b/ext/gd/tests/png2gd.phpt
@@ -1,13 +1,11 @@
--TEST--
png <--> gd1/gd2 conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
die("skip png support unavailable");
}
@@ -19,19 +17,19 @@ png <--> gd1/gd2 conversion test
echo "PNG to GD1 conversion: ";
echo imagegd(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
-
+
echo "PNG to GD2 conversion: ";
echo imagegd2(imagecreatefrompng($cwd . "/conv_test.png"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
-
+
echo "GD1 to PNG conversion: ";
echo imagepng(imagecreatefromgd($cwd . "/test.gd1"), $cwd . "/test_gd1.png") ? 'ok' : 'failed';
echo "\n";
-
+
echo "GD2 to PNG conversion: ";
echo imagepng(imagecreatefromgd2($cwd . "/test.gd2"), $cwd . "/test_gd2.png") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
@unlink($cwd . "/test_gd1.png");
diff --git a/ext/gd/tests/pngcomp.phpt b/ext/gd/tests/pngcomp.phpt
index 1974610d3..3fd7b5705 100644
--- a/ext/gd/tests/pngcomp.phpt
+++ b/ext/gd/tests/pngcomp.phpt
@@ -1,13 +1,11 @@
--TEST--
png compression test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefrompng") || !function_exists("imagepng")) {
die("skip png support unavailable");
}
@@ -27,7 +25,7 @@ png compression test
if ($col == 0xffffff) {
echo "ok\n";
}
-
+
@unlink($cwd . "/test_pngcomp.png");
?>
--EXPECT--
diff --git a/ext/gd/tests/xpm2gd.phpt b/ext/gd/tests/xpm2gd.phpt
index 9c6cca4eb..e70a13f37 100644
--- a/ext/gd/tests/xpm2gd.phpt
+++ b/ext/gd/tests/xpm2gd.phpt
@@ -1,13 +1,11 @@
--TEST--
xpm --> gd1/gd2 conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagecreatefromxpm")) {
die("skip xpm read support unavailable");
}
@@ -19,11 +17,11 @@ xpm --> gd1/gd2 conversion test
echo "XPM to GD1 conversion: ";
echo imagegd(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd1") ? 'ok' : 'failed';
echo "\n";
-
+
echo "XPM to GD2 conversion: ";
echo imagegd2(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test.gd2") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test.gd1");
@unlink($cwd . "/test.gd2");
?>
diff --git a/ext/gd/tests/xpm2jpg.phpt b/ext/gd/tests/xpm2jpg.phpt
index 3df491ce4..d412b074a 100644
--- a/ext/gd/tests/xpm2jpg.phpt
+++ b/ext/gd/tests/xpm2jpg.phpt
@@ -1,13 +1,11 @@
--TEST--
xpm --> jpeg conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagejpeg")) {
die("skip jpeg support unavailable");
}
@@ -22,7 +20,7 @@ xpm --> jpeg conversion test
echo "XPM to JPEG conversion: ";
echo imagejpeg(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.jpeg") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test_xpm.jpeg");
?>
--EXPECT--
diff --git a/ext/gd/tests/xpm2png.phpt b/ext/gd/tests/xpm2png.phpt
index 520cc3da0..a5eadffd8 100644
--- a/ext/gd/tests/xpm2png.phpt
+++ b/ext/gd/tests/xpm2png.phpt
@@ -1,13 +1,11 @@
--TEST--
xpm --> png conversion test
--SKIPIF--
-<?php
+<?php
if (!extension_loaded('gd')) {
die("skip gd extension not available.");
}
- if (!GD_BUNDLED) {
- die("skip external GD libraries always fail");
- }
+
if (!function_exists("imagepng")) {
die("skip png support unavailable");
}
@@ -22,7 +20,7 @@ xpm --> png conversion test
echo "XPM to PNG conversion: ";
echo imagepng(imagecreatefromxpm($cwd . "/conv_test.xpm"), $cwd . "/test_xpm.png") ? 'ok' : 'failed';
echo "\n";
-
+
@unlink($cwd . "/test_xpm.png");
?>
--EXPECT--