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/01/07 10:06:40 UTC

[1/3] commons-compress git commit: An example failing deflate64 zip file

Repository: commons-compress
Updated Branches:
  refs/heads/COMPRESS-380 07ed54502 -> 77a0a69e3


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/COMPRESS-380
Commit: a123142d947dbf38fc053c29291b555872c91ff2
Parents: 07ed545
Author: Dawid Weiss <da...@carrotsearch.com>
Authored: Sat Jan 6 17:14:39 2018 +0100
Committer: Stefan Bodewig <bo...@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


[2/3] commons-compress git commit: license header and whitespace

Posted by bo...@apache.org.
license header and whitespace


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

Branch: refs/heads/COMPRESS-380
Commit: 073fe2452f0514f100fa10781f081647d3384cd7
Parents: a123142
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jan 7 11:00:07 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jan 7 11:00:07 2018 +0100

----------------------------------------------------------------------
 .../compressors/deflate64/Deflate64BugTest.java | 47 +++++++++++++-------
 1 file changed, 32 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/073fe245/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
index bd8bb7a..7a51747 100644
--- a/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
@@ -1,3 +1,20 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
 package org.apache.commons.compress.compressors.deflate64;
 
 import static org.apache.commons.compress.AbstractTestCase.getFile;
@@ -10,23 +27,23 @@ 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;
+    @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;
+                        }
+                    }
+                }
             }
-          }
         }
-      }
     }
-  }
 }


[3/3] commons-compress git commit: move a few files around

Posted by bo...@apache.org.
move a few files around

closes #58


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

Branch: refs/heads/COMPRESS-380
Commit: 77a0a69e3135253b3762672ef6bdf96ebaa8a882
Parents: 073fe24
Author: Stefan Bodewig <bo...@apache.org>
Authored: Sun Jan 7 11:06:12 2018 +0100
Committer: Stefan Bodewig <bo...@apache.org>
Committed: Sun Jan 7 11:06:12 2018 +0100

----------------------------------------------------------------------
 .../zip/ZipArchiveInputStreamTest.java          |   6 +--
 .../compress/archivers/zip/ZipFileTest.java     |   4 +-
 .../compressors/deflate64/Deflate64BugTest.java |  49 -------------------
 .../deflate64/Deflate64BugsTest.java            |  49 +++++++++++++++++++
 src/test/resources/COMPRESS-380-dd.zip          | Bin 1391 -> 0 bytes
 src/test/resources/COMPRESS-380-deflatebug.zip  | Bin 15290 -> 0 bytes
 src/test/resources/COMPRESS-380-input           | Bin 3072 -> 0 bytes
 src/test/resources/COMPRESS-380.zip             | Bin 2257 -> 0 bytes
 .../resources/COMPRESS-380/COMPRESS-380-dd.zip  | Bin 0 -> 1391 bytes
 .../resources/COMPRESS-380/COMPRESS-380-input   | Bin 0 -> 3072 bytes
 .../COMPRESS-380-readbeyondmemory.zip           | Bin 0 -> 15290 bytes
 .../resources/COMPRESS-380/COMPRESS-380.zip     | Bin 0 -> 2257 bytes
 12 files changed, 54 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
index 04269ad..f09b205 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipArchiveInputStreamTest.java
@@ -210,8 +210,8 @@ public class ZipArchiveInputStreamTest {
      */
     @Test
     public void readDeflate64CompressedStream() throws Exception {
-        final File input = getFile("COMPRESS-380-input");
-        final File archive = getFile("COMPRESS-380.zip");
+        final File input = getFile("COMPRESS-380/COMPRESS-380-input");
+        final File archive = getFile("COMPRESS-380/COMPRESS-380.zip");
         try (FileInputStream in = new FileInputStream(input);
              ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(archive))) {
             byte[] orig = IOUtils.toByteArray(in);
@@ -224,7 +224,7 @@ public class ZipArchiveInputStreamTest {
     @Test
     public void readDeflate64CompressedStreamWithDataDescriptor() throws Exception {
         // this is a copy of bla.jar with META-INF/MANIFEST.MF's method manually changed to ENHANCED_DEFLATED
-        final File archive = getFile("COMPRESS-380-dd.zip");
+        final File archive = getFile("COMPRESS-380/COMPRESS-380-dd.zip");
         try (ZipArchiveInputStream zin = new ZipArchiveInputStream(new FileInputStream(archive))) {
             ZipArchiveEntry e = zin.getNextZipEntry();
             assertEquals(-1, e.getSize());

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
index 2903f77..e29f080 100644
--- a/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/zip/ZipFileTest.java
@@ -586,8 +586,8 @@ public class ZipFileTest {
      */
     @Test
     public void readDeflate64CompressedStream() throws Exception {
-        final File input = getFile("COMPRESS-380-input");
-        final File archive = getFile("COMPRESS-380.zip");
+        final File input = getFile("COMPRESS-380/COMPRESS-380-input");
+        final File archive = getFile("COMPRESS-380/COMPRESS-380.zip");
         try (FileInputStream in = new FileInputStream(input);
              ZipFile zf = new ZipFile(archive)) {
             byte[] orig = IOUtils.toByteArray(in);

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/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
deleted file mode 100644
index 7a51747..0000000
--- a/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugTest.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You under the Apache License, Version 2.0
- *  (the "License"); you may not use this file except in compliance with
- *  the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *
- */
-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/77a0a69e/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugsTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugsTest.java b/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugsTest.java
new file mode 100644
index 0000000..d21f052
--- /dev/null
+++ b/src/test/java/org/apache/commons/compress/compressors/deflate64/Deflate64BugsTest.java
@@ -0,0 +1,49 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+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 Deflate64BugsTest {
+
+    @Test
+    public void readBeyondMemoryException() throws Exception {
+        try (ZipFile zfile = new ZipFile(getFile("COMPRESS-380/COMPRESS-380-readbeyondmemory.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/77a0a69e/src/test/resources/COMPRESS-380-dd.zip
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380-dd.zip b/src/test/resources/COMPRESS-380-dd.zip
deleted file mode 100644
index 9557996..0000000
Binary files a/src/test/resources/COMPRESS-380-dd.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/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
deleted file mode 100644
index 99f352d..0000000
Binary files a/src/test/resources/COMPRESS-380-deflatebug.zip and /dev/null differ

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/src/test/resources/COMPRESS-380-input
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380-input b/src/test/resources/COMPRESS-380-input
deleted file mode 100644
index daf1f56..0000000
Binary files a/src/test/resources/COMPRESS-380-input and /dev/null differ

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/src/test/resources/COMPRESS-380.zip
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380.zip b/src/test/resources/COMPRESS-380.zip
deleted file mode 100644
index d9146be..0000000
Binary files a/src/test/resources/COMPRESS-380.zip and /dev/null differ

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

http://git-wip-us.apache.org/repos/asf/commons-compress/blob/77a0a69e/src/test/resources/COMPRESS-380/COMPRESS-380-input
----------------------------------------------------------------------
diff --git a/src/test/resources/COMPRESS-380/COMPRESS-380-input b/src/test/resources/COMPRESS-380/COMPRESS-380-input
new file mode 100644
index 0000000..daf1f56
Binary files /dev/null and b/src/test/resources/COMPRESS-380/COMPRESS-380-input differ

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

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