php-src/ext/fileinfo/tests/cve-2014-1943.phpt
Max Semenik bd9f4fa676 Migrate skip checks to --EXTENSIONS--, p2
For rationale, see https://github.com/php/php-src/pull/6787

Make extension checks lowercase, add a special case for opcache
that has internal name not matching .so filename.

Extensions migrated in part 2:
* dom
* exif
* fileinfo
* ffi
2021-04-01 12:08:24 +01:00

38 lines
808 B
PHP

--TEST--
Bug #66731: file: infinite recursion
--EXTENSIONS--
fileinfo
--FILE--
<?php
$fd = __DIR__.'/cve-2014-1943.data';
$fm = __DIR__.'/cve-2014-1943.magic';
$a = "\105\122\000\000\000\000\000";
$b = str_repeat("\001", 250000);
$m = "0 byte x\n".
">(1.b) indirect x\n";
file_put_contents($fd, $a);
$fi = finfo_open(FILEINFO_NONE);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
file_put_contents($fd, $b);
file_put_contents($fm, $m);
$fi = finfo_open(FILEINFO_NONE, $fm);
var_dump(finfo_file($fi, $fd));
finfo_close($fi);
?>
Done
--CLEAN--
<?php
@unlink(__DIR__.'/cve-2014-1943.data');
@unlink(__DIR__.'/cve-2014-1943.magic');
?>
--EXPECTF--
string(%d) "%s"
Warning: finfo_file(): Failed identify data 0:indirect count (%d) exceeded in %s on line %d
bool(false)
Done