1
0
mirror of https://github.com/php/php-src.git synced 2026-04-30 03:33:17 +02:00
Files
archived-php-src/ext/gd/tests/imagewbmp_nullbyte_injection.phpt
T
Christoph M. Becker b994fd81cb Throw TypeError instead of warning in case of invalid path
For consistency with imagegd(), imagegd2() and imagexbm(), which throw
a TypeError if a path containing NUL bytes is given, we throw a
TypeError for the other image writer functions as well.
2019-06-13 22:37:50 +02:00

22 lines
516 B
PHP

--TEST--
Testing null byte injection in imagewbmp
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
$support = gd_info();
if (!isset($support['WBMP Support']) || $support['WBMP Support'] === false) {
print 'skip wbmp support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
try {
imagewbmp($image, "./foo\0bar");
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Invalid 2nd parameter, filename must not contain null bytes