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/master Commit: 77a0a69e3135253b3762672ef6bdf96ebaa8a882 Parents: 073fe24 Author: Stefan Bodewig <bode...@apache.org> Authored: Sun Jan 7 11:06:12 2018 +0100 Committer: Stefan Bodewig <bode...@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