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 2018/05/30 09:31:08 UTC

commons-compress git commit: COMPRESS-454 search for STORED data descriptor stopped too soon

Repository: commons-compress
Updated Branches:
  refs/heads/master a1d952c23 -> c2ace8864


COMPRESS-454 search for STORED data descriptor stopped too soon


Project: http://git-wip-us.apache.org/repos/asf/commons-compress/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-compress/commit/c2ace886
Tree: http://git-wip-us.apache.org/repos/asf/commons-compress/tree/c2ace886
Diff: http://git-wip-us.apache.org/repos/asf/commons-compress/diff/c2ace886

Branch: refs/heads/master
Commit: c2ace88644826c227191ca52c8d4372a13605e50
Parents: a1d952c
Author: Stefan Bodewig <bo...@apache.org>
Authored: Wed May 30 11:30:36 2018 +0200
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Wed May 30 11:30:36 2018 +0200

----------------------------------------------------------------------
 src/changes/changes.xml                                          | 4 ++++
 .../commons/compress/archivers/zip/ZipArchiveInputStream.java    | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c2ace886/src/changes/changes.xml
----------------------------------------------------------------------
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 2e85613..dfcfd66 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -94,6 +94,10 @@ The <action> type attribute can be add,update,fix,remove.
         Added a workaround for a bug in AdoptOpenJDK for S/390 to
         BZip2CompressorInputStream.
       </action>
+      <action issue="COMPRESS-454" type="fix" date="2018-05-30">
+        ZipArchiveInputStream failed to read some files with stored
+        entries using a data descriptor.
+      </action>
     </release>
     <release version="1.16.1" date="2018-02-10"
              description="Release 1.16.1">

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/c2ace886/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
index 20caa31..729d92e 100644
--- a/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
+++ b/src/main/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStream.java
@@ -922,7 +922,7 @@ public class ZipArchiveInputStream extends ArchiveInputStream implements InputSt
 
         boolean done = false;
         int readTooMuch = 0;
-        for (int i = 0; !done && i < lastRead - 4; i++) {
+        for (int i = 0; !done && i < offset + lastRead - 4; i++) {
             if (buf.array()[i] == LFH[0] && buf.array()[i + 1] == LFH[1]) {
                 if ((buf.array()[i + 2] == LFH[2] && buf.array()[i + 3] == LFH[3])
                     || (buf.array()[i] == CFH[2] && buf.array()[i + 3] == CFH[3])) {