diff --git a/ext/phar/tests/zip/corrupt_009.phpt b/ext/phar/tests/zip/corrupt_009.phpt new file mode 100644 index 00000000000..91f142da7b2 --- /dev/null +++ b/ext/phar/tests/zip/corrupt_009.phpt @@ -0,0 +1,17 @@ +--TEST-- +Phar: corrupted zip (extra field way too long) +--SKIPIF-- + + +--FILE-- +getMessage() . "\n"; +} +?> +===DONE=== +--EXPECTF-- +phar error: Unable to process extra field header for file in central directory in zip-based phar "%sextralen_toolong.zip" +===DONE=== diff --git a/ext/phar/tests/zip/files/corrupt3.php.inc b/ext/phar/tests/zip/files/corrupt3.php.inc new file mode 100644 index 00000000000..aa0cc96d89f --- /dev/null +++ b/ext/phar/tests/zip/files/corrupt3.php.inc @@ -0,0 +1,6 @@ +addFile('hi', null, 'hii', null, null, null, 'extralen1'); +$a->writeZip(dirname(__FILE__) . '/extralen_toolong.zip'); +?> diff --git a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc index 2c1719920de..959530f2cfc 100644 --- a/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc +++ b/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc @@ -237,6 +237,15 @@ class corrupt_zipmaker $filename . $comment; $offset = strlen($central); break; + case 'extralen1' : + $extra = 'nu' . 0xffff; // way huge size + $central = "PK\x01\x02\x00\x00\x14\x00\x00\x00" . pack('v', $compmethod) . + $mtime . + pack("VVVvvvvvVV", $crc32, $complength, $uncomplength, strlen($filename), strlen($extra),strlen($comment),0x00,0x00, + 0x0000, $this->offset). + $filename . $extra . $comment; + $offset = strlen($central); + break; } return $central; } diff --git a/ext/phar/tests/zip/files/extralen_toolong.zip b/ext/phar/tests/zip/files/extralen_toolong.zip new file mode 100644 index 00000000000..a04fa6b0040 Binary files /dev/null and b/ext/phar/tests/zip/files/extralen_toolong.zip differ