git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@739300 13f79535-47bb-0310-9956-ffa450edef68master
@@ -670,6 +670,10 @@ Other changes: | |||||
processor. | processor. | ||||
Bugzilla Issue 46612. | Bugzilla Issue 46612. | ||||
* the ZIP library will now ignore ZIP extra fields that don't specify | |||||
a size. | |||||
Bugzilla Report 42940. | |||||
Changes from Ant 1.7.0 TO Ant 1.7.1 | Changes from Ant 1.7.0 TO Ant 1.7.1 | ||||
============================================= | ============================================= | ||||
@@ -117,10 +117,6 @@ public class ExtraFieldUtils { | |||||
} | } | ||||
start += (length + WORD); | start += (length + WORD); | ||||
} | } | ||||
if (start != data.length) { // array not exhausted | |||||
throw new ZipException("data starting at " + start | |||||
+ " is in unknown format"); | |||||
} | |||||
ZipExtraField[] result = new ZipExtraField[v.size()]; | ZipExtraField[] result = new ZipExtraField[v.size()]; | ||||
return (ZipExtraField[]) v.toArray(result); | return (ZipExtraField[]) v.toArray(result); | ||||
@@ -252,7 +252,7 @@ public class ZipEntry extends java.util.zip.ZipEntry implements Cloneable { | |||||
try { | try { | ||||
setExtraFields(ExtraFieldUtils.parse(extra)); | setExtraFields(ExtraFieldUtils.parse(extra)); | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
throw new RuntimeException(e.getMessage()); | |||||
throw new RuntimeException(e.getMessage(), e); | |||||
} | } | ||||
} | } | ||||
@@ -64,7 +64,7 @@ public interface ZipExtraField { | |||||
byte[] getLocalFileDataData(); | byte[] getLocalFileDataData(); | ||||
/** | /** | ||||
* The actual data to put central directory - without Header-ID or | |||||
* The actual data to put into central directory - without Header-ID or | |||||
* length specifier. | * length specifier. | ||||
* @return the data | * @return the data | ||||
* @since 1.1 | * @since 1.1 | ||||
@@ -44,6 +44,16 @@ | |||||
<au:assertFileExists file="${output}/foo/file"/> | <au:assertFileExists file="${output}/foo/file"/> | ||||
</target> | </target> | ||||
<target name="testTwoByteExtraFieldInLFH" | |||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=42940" | |||||
> | |||||
<mkdir dir="${input}"/> | |||||
<mkdir dir="${output}"/> | |||||
<copy file="zip/Bugzilla-42940.zip" tofile="${input}/test.zip"/> | |||||
<unzip src="${input}/test.zip" dest="${output}"/> | |||||
<au:assertFileExists file="${output}/META-INF/MANIFEST.MF"/> | |||||
</target> | |||||
<target name="testArchiveIsClosedForInvalidZips" | <target name="testArchiveIsClosedForInvalidZips" | ||||
description="https://issues.apache.org/bugzilla/show_bug.cgi?id=46559" | description="https://issues.apache.org/bugzilla/show_bug.cgi?id=46559" | ||||
> | > | ||||
@@ -40,7 +40,7 @@ public class ExtraFieldUtilsTest extends TestCase implements UnixStat { | |||||
a.setDirectory(true); | a.setDirectory(true); | ||||
dummy = new UnrecognizedExtraField(); | dummy = new UnrecognizedExtraField(); | ||||
dummy.setHeaderId(new ZipShort(1)); | dummy.setHeaderId(new ZipShort(1)); | ||||
dummy.setLocalFileDataData(new byte[0]); | |||||
dummy.setLocalFileDataData(new byte[] {0}); | |||||
dummy.setCentralDirectoryData(new byte[] {0}); | dummy.setCentralDirectoryData(new byte[] {0}); | ||||
aLocal = a.getLocalFileDataData(); | aLocal = a.getLocalFileDataData(); | ||||
@@ -68,7 +68,7 @@ public class ExtraFieldUtilsTest extends TestCase implements UnixStat { | |||||
assertEquals("mode field 1", 040755, | assertEquals("mode field 1", 040755, | ||||
((AsiExtraField) ze[0]).getMode()); | ((AsiExtraField) ze[0]).getMode()); | ||||
assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField); | assertTrue("type field 2", ze[1] instanceof UnrecognizedExtraField); | ||||
assertEquals("data length field 2", 0, | |||||
assertEquals("data length field 2", 1, | |||||
ze[1].getLocalFileDataLength().getValue()); | ze[1].getLocalFileDataLength().getValue()); | ||||
byte[] data2 = new byte[data.length-1]; | byte[] data2 = new byte[data.length-1]; | ||||