summaryrefslogtreecommitdiff
path: root/ext/gd/tests/imagepng_nullbyte_injection.phpt
blob: 8a415478ddcef4be6e9c5d4d02dd2604fd735a5d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
--TEST--
Testing null byte injection in imagepng
--SKIPIF--
<?php
if(!extension_loaded('gd')){ die('skip gd extension not available'); }
$support = gd_info();
if (!isset($support['PNG Support']) || $support['PNG Support'] === false) {
    print 'skip png support not available';
}
?>
--FILE--
<?php
$image = imagecreate(1,1);// 1px image
try {
    imagepng($image, "./foo\0bar");
} catch (TypeError $e) {
    echo $e->getMessage(), "\n";
}
?>
--EXPECT--
imagepng(): Argument #2 ($to) must not contain null bytes