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

24 lines
880 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";?>
--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('VVVVC', 0, time(), 0, crc32(''), 0);
$file .= pack('VVnV', strlen($manifest), 1, 0x0800, 3) . 'hio' . $manifest;
2006-01-04 16:43:42 +00:00
file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
2005-12-10 02:33:35 +00:00
echo file_get_contents('phar://hio/a');
?>
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--
%satal error: Phar::mapPhar(): internal corruption of phar "%s" (too many manifest entries for size of manifest) in %s on line %d