1--TEST--
2Bug #66731: file: extensive backtraking
3--SKIPIF--
4<?php
5if (!class_exists('finfo'))
6	die('skip no fileinfo extension');
7--FILE--
8<?php
9$fd = __DIR__.'/cve-2014-3538.data';
10
11file_put_contents($fd,
12  'try:' .
13  str_repeat("\n", 1000000));
14
15$fi = finfo_open(FILEINFO_NONE);
16$t = microtime(true);
17var_dump(finfo_file($fi, $fd));
18$t = microtime(true) - $t;
19finfo_close($fi);
20if ($t < 1) {
21	echo "Ok\n";
22} else {
23	printf("Failed, time=%.2f\n", $t);
24}
25
26?>
27Done
28--CLEAN--
29<?php
30@unlink(__DIR__.'/cve-2014-3538.data');
31?>
32--EXPECTF--
33string(%d) "%s"
34Ok
35Done