diff options
-rw-r--r-- | poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java | 1 | ||||
-rw-r--r-- | poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java | 9 | ||||
-rw-r--r-- | test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx | bin | 0 -> 10721 bytes |
3 files changed, 10 insertions, 0 deletions
diff --git a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java index a6a4480065..fafbab4195 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java @@ -99,6 +99,7 @@ public class TestAllFiles { // corrupt file "spreadsheet/duplicate-filename.xlsx", + "spreadsheet/duplicate-filename-case-insensitive.xlsx", "document/clusterfuzz-testcase-minimized-POIXWPFFuzzer-5166796835258368.docx", }; diff --git a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java index 78c0eb1796..7926912f6c 100644 --- a/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java +++ b/poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java @@ -1476,6 +1476,15 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook { } @Test + void testDuplicateFileCaseInsensitiveReadAsStream() { + assertThrows(InvalidZipException.class, () -> { + try (XSSFWorkbook wb = new XSSFWorkbook(openSampleFileStream("duplicate-filename-case-insensitive.xlsx"))) { + // expect exception here + } + }); + } + + @Test void testWorkbookCloseClosesInputStream() throws Exception { try (TrackingInputStream stream = new TrackingInputStream( HSSFTestDataSamples.openSampleFileStream("github-321.xlsx"))) { diff --git a/test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx b/test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx Binary files differnew file mode 100644 index 0000000000..2e74ac3213 --- /dev/null +++ b/test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx |