You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/08/03 18:08:58 UTC

(commons-compress) 02/02: Add org.apache.commons.compress.archivers.sevenz.SevenZFileTest.testCreateBoundedInputStream()

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git

commit cb0d5ea27f37e4239a8108b01e3d067cfd463e37
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 3 14:08:50 2025 -0400

    Add org.apache.commons.compress.archivers.sevenz.SevenZFileTest.testCreateBoundedInputStream()
---
 .../commons/compress/archivers/sevenz/SevenZFileTest.java |   6 ++++++
 .../commons/compress/zip/createBoundedInputStream.bin     | Bin 0 -> 157 bytes
 2 files changed, 6 insertions(+)

diff --git a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
index 036663cc0..5a78e006f 100644
--- a/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/sevenz/SevenZFileTest.java
@@ -263,6 +263,12 @@ void testCompressedHeaderWithNonDefaultDictionarySize() throws Exception {
         }
     }
 
+    @Test
+    void testCreateBoundedInputStream() throws IOException {
+        assertThrows(ArchiveException.class,
+                () -> SevenZFile.builder().setPath("src/test/resources/org/apache/commons/compress/zip/createBoundedInputStream.bin").get().close());
+    }
+
     @Test
     void testEncryptedArchiveRequiresPassword() throws Exception {
         final PasswordRequiredException ex = assertThrows(PasswordRequiredException.class, () -> getSevenZFile("bla.encrypted.7z").close(),
diff --git a/src/test/resources/org/apache/commons/compress/zip/createBoundedInputStream.bin b/src/test/resources/org/apache/commons/compress/zip/createBoundedInputStream.bin
new file mode 100644
index 000000000..72750fb1d
Binary files /dev/null and b/src/test/resources/org/apache/commons/compress/zip/createBoundedInputStream.bin differ