mirror of
https://github.com/php/php-src.git
synced 2024-12-20 07:20:33 +08:00
b994fd81cb
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.
19 lines
437 B
PHP
19 lines
437 B
PHP
--TEST--
|
|
Testing null byte injection in imagebmp
|
|
--SKIPIF--
|
|
<?php
|
|
if(!extension_loaded('gd')) die('skip gd extension not available');
|
|
if (!gd_info()['BMP Support']) die('skip BMP support not available');
|
|
?>
|
|
--FILE--
|
|
<?php
|
|
$image = imagecreate(1,1);// 1px image
|
|
try {
|
|
imagebmp($image, "./foo\0bar");
|
|
} catch (TypeError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
?>
|
|
--EXPECT--
|
|
Invalid 2nd parameter, filename must not contain null bytes
|