cellog          Thu Aug 21 20:35:12 2008 UTC

  Modified files:              
    /php-src/ext/phar/tests/zip corrupt_009.phpt 
    /php-src/ext/phar/tests/zip/files   corrupt3.php.inc 
                                        extralen_toolong.zip 
                                        corrupt_zipmaker.php.inc 
  Log:
  MFB increase code coverage
  
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/corrupt_009.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/phar/tests/zip/corrupt_009.phpt
diff -u /dev/null php-src/ext/phar/tests/zip/corrupt_009.phpt:1.2
--- /dev/null   Thu Aug 21 20:35:12 2008
+++ php-src/ext/phar/tests/zip/corrupt_009.phpt Thu Aug 21 20:35:12 2008
@@ -0,0 +1,17 @@
+--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===
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/corrupt3.php.inc?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/phar/tests/zip/files/corrupt3.php.inc
diff -u /dev/null php-src/ext/phar/tests/zip/files/corrupt3.php.inc:1.2
--- /dev/null   Thu Aug 21 20:35:12 2008
+++ php-src/ext/phar/tests/zip/files/corrupt3.php.inc   Thu Aug 21 20:35:12 2008
@@ -0,0 +1,9 @@
+<?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');
+?>
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/extralen_toolong.zip?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/phar/tests/zip/files/extralen_toolong.zip
http://cvs.php.net/viewvc.cgi/php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc
diff -u php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.7 
php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.8
--- php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc:1.7       Fri Aug 
 1 13:36:19 2008
+++ php-src/ext/phar/tests/zip/files/corrupt_zipmaker.php.inc   Thu Aug 21 
20:35:12 2008
@@ -26,7 +26,7 @@
  * @author     Vincent Lascaux <[EMAIL PROTECTED]>
  * @copyright  1997-2005 The PHP Group
  * @license    http://www.gnu.org/copyleft/lesser.html  LGPL
- * @version    CVS: $Id: corrupt_zipmaker.php.inc,v 1.7 2008/08/01 13:36:19 
sfox Exp $
+ * @version    CVS: $Id: corrupt_zipmaker.php.inc,v 1.8 2008/08/21 20:35:12 
cellog Exp $
  * @link       http://pear.php.net/package/File_Archive
  */
 
@@ -237,6 +237,15 @@
                                                $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;
        }
@@ -279,6 +288,12 @@
                                        $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,



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to