From bfd4645a726c13eef376a5127c8aca4f40f5e8f6 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Tue, 9 Jul 2024 14:16:47 +0000 Subject: [PATCH] add test case git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1919064 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/stress/TestAllFiles.java | 1 + .../poi/xssf/usermodel/TestXSSFWorkbook.java | 9 +++++++++ .../duplicate-filename-case-insensitive.xlsx | Bin 0 -> 10721 bytes 3 files changed, 10 insertions(+) create mode 100644 test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx 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 @@ -1475,6 +1475,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( diff --git a/test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx b/test-data/spreadsheet/duplicate-filename-case-insensitive.xlsx new file mode 100644 index 0000000000000000000000000000000000000000..2e74ac3213004e24bd4484dc85078c1ed770d740 GIT binary patch literal 10721 zcmeHMg;!N=*1t4}G}6)`ARW>v-AH#gT)Mj(q@|G(kdl&a>244&9nvUW-^F)k;B~&4 ze_-5qopYYE*7NLj&+ff{@={RHm;iWqcmM!E0=^yy0{{=HDGao6G`4ZnRdTa6cF?AG zwYDOD4-NSu8vyyR@z3giQ39n(L$Z)es4Z#d$Z0x#HthjS!9fB1ViagZ**2zg!8Qwy zuz__hwZ2TS5KzhNdxK{aiNhZ)hC- zMXRW}%Vd)l`qUm8N2gyTpd&~cw zR4+93B0Sd3-jBt~DCJ>K*(YnMUu>^lcV4;Kr5MFX>CO~D?v;oP#6k)~=T|~xPh*+W zYZz-C`0@o%jlr$qkX?h?=?jrF;3)mYVGqeg3iz&iN45Q6z22X)?_nbKvm((GT)nzO zBkC&0XJ5U*LLWjC%&UQE`bj30*OP$%Ot4j9&1Y!^*4zHTv-f9KWD7uE3JzXc5E4xe z0sx4G27urHlV2i&{ZiN7*vf%{{{H^QAO9D<@87?J5H`F zgW>1`&K#6k?XfWWz^qMj%S}_~ETs0fzSzKcp`6gdB2U!!UXs%l){hbBnA~KwE~UYB zmu@Ej8cO>lQM-@JU1-izdqby*Vv_YQoSS24-e^sZ=C2W<w_Q6BI$iIF{ z=gtgO6Pfm@spl{aV#>ehR7H4pfm{Bh?+2TedFr>r_>|5r`V4bF9xCUgz5Wm_BE_si z1-781cv#vEiV(86GZ9g!%vbYTz@KN;9CoBqVWZ+p1AMx;$$`^%_3w?p#0>GQgaj^Y z8=X71cOxlf-TO+7G9%dzSPIhMMD(A11qHmr)r!FdXm4o%1X|wbuTmuiU>YN;cUJYC zuWR8fG^C(RF{(dSQBg6gWnE!E3{@p04lY$r@g>NGlBC*_Nd6U~)i9sWnO93^vZ`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