Annotation of embedaddon/php/ext/phar/tests/010.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Phar::mapPhar buffer overrun
                      3: --SKIPIF--
                      4: <?php if (!extension_loaded("phar")) die("skip");?>
                      5: --INI--
                      6: phar.require_hash=0
                      7: --FILE--
                      8: <?php
                      9: $file = b"<?php
                     10: Phar::mapPhar('hio');
                     11: __HALT_COMPILER(); ?>";
                     12: 
                     13: // this fails because the manifest length does not include the other 10 byte manifest data
                     14: 
                     15: $manifest = pack('V', 1) . 'a' . pack('VVVVVV', 0, time(), 0, crc32(b''), 0x00000000, 0);
                     16: $file .= pack('VVnVV', strlen($manifest), 1, 0x1000, 0x00000000, 3) . 'hio' . pack('V', 0) . $manifest;
                     17: 
                     18: file_put_contents(dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php', $file);
                     19: try {
                     20: include dirname(__FILE__) . '/' . basename(__FILE__, '.php') . '.phar.php';
                     21: echo file_get_contents('phar://hio/a');
                     22: } catch (Exception $e) {
                     23: echo $e->getMessage();
                     24: }
                     25: ?>
                     26: --CLEAN--
                     27: <?php unlink(dirname(__FILE__) . '/' . basename(__FILE__, '.clean.php') . '.phar.php'); ?>
                     28: --EXPECTF--
                     29: internal corruption of phar "%s" (too many manifest entries for size of manifest)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>