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 2023/11/14 14:08:52 UTC
(commons-compress) branch master updated: COMPRESS-632: Fix for zero size headers in ArjInputStream (#439)
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
The following commit(s) were added to refs/heads/master by this push:
new 927c4fa38 COMPRESS-632: Fix for zero size headers in ArjInputStream (#439)
927c4fa38 is described below
commit 927c4fa388e6e8e88d80248a2f27240715b316c1
Author: Yakov Shafranovich <ya...@users.noreply.github.com>
AuthorDate: Tue Nov 14 09:08:46 2023 -0500
COMPRESS-632: Fix for zero size headers in ArjInputStream (#439)
* fix for zero size headers in ArjInputStream
* removed code change
---------
Co-authored-by: Yakov Shafranovich <ya...@amazon.com>
---
.../archivers/arj/ArjArchiveInputStreamTest.java | 14 ++++++++++++++
src/test/resources/arj/zero_sized_headers.arj | Bin 0 -> 3142 bytes
2 files changed, 14 insertions(+)
diff --git a/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
index 487c830d2..697a21964 100644
--- a/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/arj/ArjArchiveInputStreamTest.java
@@ -21,13 +21,17 @@ package org.apache.commons.compress.archivers.arj;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertThrows;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import java.io.IOException;
import java.io.InputStream;
import java.util.Calendar;
import java.util.TimeZone;
import org.apache.commons.compress.AbstractTest;
import org.apache.commons.compress.archivers.ArchiveEntry;
+import org.apache.commons.compress.archivers.ArchiveException;
import org.apache.commons.compress.utils.IOUtils;
import org.junit.jupiter.api.Test;
@@ -107,4 +111,14 @@ public class ArjArchiveInputStreamTest extends AbstractTest {
}
}
+ @Test
+ public void testFirstHeaderSizeSetToZero() throws Exception {
+ try (InputStream in = newInputStream("arj/zero_sized_headers.arj")) {
+ final ArchiveException ex = assertThrows(ArchiveException.class, () -> {
+ ArjArchiveInputStream archive = new ArjArchiveInputStream(in);
+ });
+ assertTrue(ex.getCause() instanceof IOException);
+ }
+ }
+
}
diff --git a/src/test/resources/arj/zero_sized_headers.arj b/src/test/resources/arj/zero_sized_headers.arj
new file mode 100644
index 000000000..7d9a8c8d5
Binary files /dev/null and b/src/test/resources/arj/zero_sized_headers.arj differ