You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by bo...@apache.org on 2013/05/26 19:36:35 UTC
svn commit: r1486437 - in /commons/proper/compress/trunk/src: changes/
main/java/org/apache/commons/compress/archivers/zip/
test/java/org/apache/commons/compress/archivers/zip/ test/resources/
Author: bodewig
Date: Sun May 26 17:36:35 2013
New Revision: 1486437
URL: http://svn.apache.org/r1486437
Log:
COMPRESS-228 be more lenient when parsing zip64 extra field
Added:
commons/proper/compress/trunk/src/test/resources/COMPRESS-228.zip (with props)
Modified:
commons/proper/compress/trunk/src/changes/changes.xml
commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
Modified: commons/proper/compress/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/changes/changes.xml?rev=1486437&r1=1486436&r2=1486437&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/changes/changes.xml (original)
+++ commons/proper/compress/trunk/src/changes/changes.xml Sun May 26 17:36:35 2013
@@ -49,6 +49,11 @@ The <action> type attribute can be add,u
TarBuffer.tryToConsumeSecondEOFRecord could throw a
NullPointerException
</action>
+ <action type="fix" date="2013-05-26" issue="COMPRESS-228">
+ Parsing of zip64 extra fields has become more lenient in order
+ to be able to read archives created by DotNetZip and maybe
+ other archivers as well.
+ </action>
</release>
<release version="1.5" date="2013-03-14"
description="Release 1.5">
Modified: commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java?rev=1486437&r1=1486436&r2=1486437&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java (original)
+++ commons/proper/compress/trunk/src/main/java/org/apache/commons/compress/archivers/zip/Zip64ExtendedInformationExtraField.java Sun May 26 17:36:35 2013
@@ -242,7 +242,7 @@ public class Zip64ExtendedInformationExt
* field with knowledge which fields are expected to be there.
*
* <p>All four fields inside the zip64 extended information extra
- * field are optional and only present if their corresponding
+ * field are optional and must only be present if their corresponding
* entry inside the central directory contains the correct magic
* value.</p>
*/
@@ -256,7 +256,7 @@ public class Zip64ExtendedInformationExt
+ (hasCompressedSize ? DWORD : 0)
+ (hasRelativeHeaderOffset ? DWORD : 0)
+ (hasDiskStart ? WORD : 0);
- if (rawCentralDirectoryData.length != expectedLength) {
+ if (rawCentralDirectoryData.length < expectedLength) {
throw new ZipException("central directory zip64 extended"
+ " information extra field's length"
+ " doesn't match central directory"
Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java?rev=1486437&r1=1486436&r2=1486437&view=diff
==============================================================================
--- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java (original)
+++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java Sun May 26 17:36:35 2013
@@ -226,6 +226,18 @@ public class ZipFileTest extends TestCas
assertEquals(2, numberOfEntries);
}
+ /**
+ * @see https://issues.apache.org/jira/browse/COMPRESS-228
+ */
+ public void testExcessDataInZip64ExtraField() throws Exception {
+ File archive = getFile("COMPRESS-228.zip");
+ zf = new ZipFile(archive);
+ // actually, if we get here, the test already has passed
+
+ ZipArchiveEntry ze = zf.getEntry("src/main/java/org/apache/commons/compress/archivers/zip/ZipFile.java");
+ assertEquals(26101, ze.getSize());
+ }
+
/*
* ordertest.zip has been handcrafted.
*
Added: commons/proper/compress/trunk/src/test/resources/COMPRESS-228.zip
URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/resources/COMPRESS-228.zip?rev=1486437&view=auto
==============================================================================
Binary file - no diff available.
Propchange: commons/proper/compress/trunk/src/test/resources/COMPRESS-228.zip
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream