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 17:31:38 UTC
(commons-compress) branch master updated: Add org.apache.commons.compress.archivers.cpio.CpioArchiveInputStreamTest.testEndOfFileInEntry_c_namesize_0x7FFFFFFF()
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 7a6bf75f6 Add org.apache.commons.compress.archivers.cpio.CpioArchiveInputStreamTest.testEndOfFileInEntry_c_namesize_0x7FFFFFFF()
7a6bf75f6 is described below
commit 7a6bf75f66130a12afe519f8b6e0901348586e0f
Author: Gary D. Gregory <ga...@gmail.com>
AuthorDate: Sun Aug 3 13:31:33 2025 -0400
Add org.apache.commons.compress.archivers.cpio.CpioArchiveInputStreamTest.testEndOfFileInEntry_c_namesize_0x7FFFFFFF()
---
.../archivers/cpio/CpioArchiveInputStreamTest.java | 27 ++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
index 6d66fd6de..7520ed6c0 100644
--- a/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
+++ b/src/test/java/org/apache/commons/compress/archivers/cpio/CpioArchiveInputStreamTest.java
@@ -82,6 +82,33 @@ void testCpioUnarchiveMultibyteCharName() throws Exception {
assertEquals(2, count);
}
+ @Test
+ void testEndOfFileInEntry_c_namesize_0x7FFFFFFF() throws Exception {
+ // CPIO header with c_namesize = 0x7FFFFFFF
+ // @formatter:off
+ final String header =
+ "070701" + // c_magic
+ "00000000" + // c_ino
+ "000081A4" + // c_mode
+ "00000000" + // c_uid
+ "00000000" + // c_gid
+ "00000001" + // c_nlink
+ "00000000" + // c_mtime
+ "00000000" + // c_filesize
+ "00000000" + // c_devmajor
+ "00000000" + // c_devminor
+ "00000000" + // c_rdevmajor
+ "00000000" + // c_rdevminor
+ "7FFFFFFF" + // c_namesize
+ "00000000"; // c_check
+ // @formatter:on
+ final byte[] data = new byte[header.getBytes(StandardCharsets.US_ASCII).length + 1];
+ System.arraycopy(header.getBytes(), 0, data, 0, header.getBytes().length);
+ try (CpioArchiveInputStream cpio = new CpioArchiveInputStream(new ByteArrayInputStream(data))) {
+ assertThrows(EOFException.class, () -> cpio.getNextEntry());
+ }
+ }
+
@Test
void testEndOfFileInEntry_c_namesize_0xFFFFFFFF() throws Exception {
// CPIO header with c_namesize = 0xFFFFFFFF