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