--- /dev/null
+--TEST--
+Phar: corrupted zip (extra field way too long)
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+--FILE--
+<?php
+try {
+ new PharData(dirname(__FILE__) . '/files/extralen_toolong.zip');
+} catch (Exception $e) {
+ echo $e->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===
--- /dev/null
+--TEST--
+Phar: unable to process zip (zip spanning multiple archives)
+--SKIPIF--
+<?php if (!extension_loaded("phar")) die("skip"); ?>
+<?php if (!extension_loaded("spl")) die("skip SPL not available"); ?>
+--FILE--
+<?php
+try {
+ new PharData(dirname(__FILE__) . '/files/disknumber.zip');
+} catch (Exception $e) {
+ echo $e->getMessage() . "\n";
+}
+?>
+===DONE===
+--EXPECTF--
+phar error: split archives spanning multiple zips cannot be processed in zip-based phar "%sdisknumber.zip"
+===DONE===
--- /dev/null
+<?php
+include dirname(__FILE__) . '/corrupt_zipmaker.php.inc';
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii', null, null, null, 'extralen1');
+$a->writeZip(dirname(__FILE__) . '/extralen_toolong.zip');
+$a = new corrupt_zipmaker;
+$a->addFile('hi', null, 'hii');
+$a->writeZip(dirname(__FILE__) . '/disknumber.zip', 'disknumber');
+?>
$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;
}
$this->offset, strlen($this->start),
strlen($this->comment)) . $this->comment;
break;
+ case 'disknumber' :
+ $write .= "PK\x05\x06\x01\x00\x01\x00" .
+ pack("vvVVv", $this->count, $this->count,
+ $this->offset, strlen($this->start),
+ strlen($this->comment)) . $this->comment;
+ break;
case 'count1' :
$write .= "PK\x05\x06\x00\x00\x00\x00" .
pack("vvVVv", $this->count + 1, $this->count,