php-src/ext/phar/tests/010.phpt

30 lines
957 B
Plaintext
Raw Normal View History

2005-12-10 02:33:35 +00:00
--TEST--
Phar::mapPhar buffer overrun
2005-12-10 02:33:35 +00:00
--SKIPIF--
<?php if (!extension_loaded("phar")) print "skip";?>
--INI--
phar.require_hash=0
2005-12-10 02:33:35 +00:00
--FILE--
<?php
$file = "<?php
Phar::mapPhar('hio');
2005-12-10 02:33:35 +00:00
__HALT_COMPILER(); ?>";
// this fails because the manifest length does not include the other 10 byte manifest data
$manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32(''), 0x00000000, 0);
$file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest;
2006-01-04 16:43:42 +00:00
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
try {
2006-01-04 16:43:42 +00:00
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
2005-12-10 02:33:35 +00:00
echo file_get_contents('phar://hio/a');
} catch (Exception $e) {
echo $e->getMessage();
}
2005-12-10 02:33:35 +00:00
?>
2006-01-04 16:43:42 +00:00
--CLEAN--
<?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
2005-12-10 02:33:35 +00:00
--EXPECTF--
internal corruption of phar "%s" (too many manifest entries for size of manifest)