Edit report at http://bugs.php.net/bug.php?id=52091&edit=1

 ID:               52091
 Updated by:       fel...@php.net
 Reported by:      hardcorevenom at gmx dot de
 Summary:          ZipArchive: CRC32 errors / corrupted archives not
                   reported
-Status:           Open
+Status:           Assigned
 Type:             Bug
 Package:          Zip Related
 Operating System: Linux
 PHP Version:      5.2.13
 Assigned To:      pajoye



Previous Comments:
------------------------------------------------------------------------
[2010-06-23 18:38:26] hardcorevenom at gmx dot de

File "_test.php" is bad in this archive

http://www-user.tu-chemnitz.de/~womar/test/zipview/test_broken.zip



Can be seen here:
http://www-user.tu-chemnitz.de/~womar/test/zipview/ziptest.php?file=test_broken.zip

------------------------------------------------------------------------
[2010-06-20 17:57:17] paj...@php.net

Do you have an archive to reproduce this problem (small if possible :)?

------------------------------------------------------------------------
[2010-06-16 00:35:49] hardcorevenom at gmx dot de

"Actual result" should be

CRC32 errors are reported not always.

------------------------------------------------------------------------
[2010-06-15 23:29:45] hardcorevenom at gmx dot de

Summary modified.

------------------------------------------------------------------------
[2010-06-15 23:26:34] hardcorevenom at gmx dot de

Description:
------------
I corrupted a file using a hex editor.

"echo shell_exec('unzip -t file')" shows the CRC32 mismatch.



ZipArchive::extractTo() doesn't report CRC32 errors.



Reading a stream received from ZipArchive::getStream('myfile') echoes a
CRC error if the number of bytes read with one fread() is below 2157
bytes.



Test script:
---------------
$zip = new ZipArchive();

if ($zip->open('test.zip')) {

  zip->extractTo('mydir'); //no error printed



  $fp = $z->getStream('brokenfile');

  while (!feof($fp)) {

    $buf .= fread($fp, 2048+108); //CRC error printed

  }

  $fclose($fp);



  $fp = $z->getStream('brokenfile');

  while (!feof($fp)) {

    $buf .= fread($fp, 2048+109); //CRC error NOT printed

  }

  $fclose($fp);



  zip.close()

}

Expected result:
----------------
A CRC32 error report that can be handled.



The one from "fread($fp, 2048+108)" is fine: "Warning: fread()
[function.fread]: Zip stream error: CRC error in ..." (can be handled
with "ob_get_contents()");



For "ZipArchive::extractTo()" the corrupt file(s) should be printed.

Actual result:
--------------
CRC32 errors are reported always.


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52091&edit=1

Reply via email to