commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bode...@apache.org
Subject [19/28] commons-compress git commit: An example failing deflate64 zip file
Date Tue, 09 Jan 2018 17:41:12 GMT
An example failing deflate64 zip file


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

Branch: refs/heads/master
Commit: a123142d947dbf38fc053c29291b555872c91ff2
Parents: 07ed545
Author: Dawid Weiss <dawid.weiss@carrotsearch.com>
Authored: Sat Jan 6 17:14:39 2018 +0100
Committer: Stefan Bodewig <bodewig@apache.org>
Committed: Sun Jan 7 10:58:51 2018 +0100

----------------------------------------------------------------------
 .../compressors/deflate64/Deflate64BugTest.java |  32 +++++++++++++++++++
 src/test/resources/COMPRESS-380-deflatebug.zip  | Bin 0 -> 15290 bytes
 2 files changed, 32 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a123142d/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
b/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
new file mode 100644
index 0000000..bd8bb7a
--- /dev/null
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
@@ -0,0 +1,32 @@
+package org.apache.commons.compress.compressors.deflate64;
+
+import static org.apache.commons.compress.AbstractTestCase.getFile;
+
+import java.io.InputStream;
+import java.util.Enumeration;
+
+import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
+import org.apache.commons.compress.archivers.zip.ZipFile;
+import org.junit.Test;
+
+public class Deflate64BugTest {
+  @Test
+  public void readBeyondMemoryException() throws Exception {
+    try (ZipFile zfile = new ZipFile(getFile("COMPRESS-380-deflatebug.zip"))) { 
+      Enumeration<ZipArchiveEntry> entries = zfile.getEntries();
+      while (entries.hasMoreElements()) {
+        ZipArchiveEntry e = entries.nextElement();
+
+        byte [] buf = new byte [1024 * 8];
+        try (InputStream is = zfile.getInputStream(e)) {
+          while (true) {
+            int read = is.read(buf);
+            if (read == -1) {
+              break;
+            }
+          }
+        }
+      }
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/a123142d/src/test/resources/COMPRESS-380-deflatebug.zip
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380-deflatebug.zip b/src/test/resources/COMPRESS-380-deflatebug.zip
new file mode 100644
index 0000000..99f352d
Binary files /dev/null and b/src/test/resources/COMPRESS-380-deflatebug.zip differ


Mime
View raw message