From 3fb018053018728cd4a6d4d873607092012fd54e Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sun, 26 May 2013 17:40:48 +0000 Subject: [PATCH] merge zip64 fix from commons compress git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@1486439 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../apache/tools/zip/Zip64ExtendedInformationExtraField.java | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 6fb87ff7a..43b16c46a 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -8,6 +8,9 @@ Changes that could break older environments: Fixed bugs: ----------- + * 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. Other changes: -------------- diff --git a/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java b/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java index c02b291c5..ad410e093 100644 --- a/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java +++ b/src/main/org/apache/tools/zip/Zip64ExtendedInformationExtraField.java @@ -240,7 +240,7 @@ public class Zip64ExtendedInformationExtraField * field with knowledge which fields are expected to be there. * *

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.

*/ @@ -254,7 +254,7 @@ public class Zip64ExtendedInformationExtraField + (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"