ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject svn commit: r1439115 - /ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java
Date Sun, 27 Jan 2013 16:36:52 GMT
Author: bodewig
Date: Sun Jan 27 16:36:52 2013
New Revision: 1439115

URL: http://svn.apache.org/viewvc?rev=1439115&view=rev
Log:
don't search beyond the start of the archive

Modified:
    ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java

Modified: ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java
URL: http://svn.apache.org/viewvc/ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java?rev=1439115&r1=1439114&r2=1439115&view=diff
==============================================================================
--- ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java (original)
+++ ant/core/trunk/src/main/org/apache/tools/zip/ZipFile.java Sun Jan 27 16:36:52 2013
@@ -667,13 +667,19 @@ public class ZipFile {
     private void positionAtCentralDirectory()
         throws IOException {
         positionAtEndOfCentralDirectoryRecord();
-        archive.seek(archive.getFilePointer() - ZIP64_EOCDL_LENGTH);
-        archive.readFully(WORD_BUF);
-        boolean found = Arrays.equals(ZipOutputStream.ZIP64_EOCD_LOC_SIG,
-                                      WORD_BUF);
+        boolean found = false;
+        boolean searchedForZip64EOCD =
+            archive.getFilePointer() > ZIP64_EOCDL_LENGTH;
+        if (searchedForZip64EOCD) {
+            archive.seek(archive.getFilePointer() - ZIP64_EOCDL_LENGTH);
+            archive.readFully(WORD_BUF);
+            found = Arrays.equals(ZipOutputStream.ZIP64_EOCD_LOC_SIG, WORD_BUF);
+        }
         if (!found) {
             // not a ZIP64 archive
-            skipBytes(ZIP64_EOCDL_LENGTH - WORD);
+            if (searchedForZip64EOCD) {
+                skipBytes(ZIP64_EOCDL_LENGTH - WORD);
+            }
             positionAtCentralDirectory32();
         } else {
             positionAtCentralDirectory64();



Mime
View raw message