summaryrefslogtreecommitdiff
path: root/ext/fileinfo/tests/cve-2014-3538.phpt
blob: 7014629f3721f9dac22b87377874539117c0463a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
--TEST--
Bug #66731: file: extensive backtraking
--SKIPIF--
<?php
if (!class_exists('finfo'))
	die('skip no fileinfo extension');
--FILE--
<?php
$fd = __DIR__.'/cve-2014-3538.data';

file_put_contents($fd,
  'try:' .
  str_repeat("\n", 1000000));

$fi = finfo_open(FILEINFO_NONE);
$t = microtime(true);
var_dump(finfo_file($fi, $fd));
$t = microtime(true) - $t;
finfo_close($fi);
if ($t < 1) {
	echo "Ok\n";
} else {
	printf("Failed, time=%.2f\n", $t);
}

?>
Done
--CLEAN--
<?php
@unlink(__DIR__.'/cve-2014-3538.data');
?>
--EXPECTF--
string(%d) "%s"
Ok
Done