From: Greg Beaver Date: Sat, 10 Dec 2005 02:33:09 +0000 (+0000) Subject: crc32 mismatch test X-Git-Tag: RELEASE_1_0_4~435 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0552791eca832047e532b0f38d8c5d358098a016;p=php crc32 mismatch test --- diff --git a/ext/phar/tests/014.phpt b/ext/phar/tests/014.phpt new file mode 100644 index 0000000000..a59507705c --- /dev/null +++ b/ext/phar/tests/014.phpt @@ -0,0 +1,20 @@ +--TEST-- +PHP_Archive::mapPhar filesize mismatch +--SKIPIF-- + +--FILE-- +"; +// wrong crc32 +$manifest = pack('V', 1) . 'a' . pack('VVVV', 1, time(), 0, 9); +$file .= pack('VV', strlen($manifest) + 4, 1) . $manifest . pack('VV', crc32('b'), 1) . 'a'; +file_put_contents(dirname(__FILE__) . '/008_phar.php', $file); +include dirname(__FILE__) . '/008_phar.php'; +echo file_get_contents('phar://hio/a'); +?> +--EXPECTF-- +Fatal error: file_get_contents(): phar error: internal corruption of phar "%s" (crc32 mismatch on file "a") in %s on line 12 \ No newline at end of file