From f6b1435db196b4a2d7079191a15a4018915f70a5 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Mon, 7 Aug 2023 12:09:31 +0000 Subject: Bug 66425: Avoid a ClassCastException found via oss-fuzz We try to avoid throwing ClassCastException, but it was possible to trigger one here with a specially crafted input-file Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61243 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911507 13f79535-47bb-0310-9956-ffa450edef68 --- .../src/test/java/org/apache/poi/stress/HPSFFileHandler.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'poi-integration/src') diff --git a/poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java b/poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java index fff7daa8ec..705bed2e53 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java @@ -43,8 +43,6 @@ import org.apache.poi.util.TempFile; import org.junit.jupiter.api.Test; public class HPSFFileHandler extends POIFSFileHandler { - private static final String NL = System.getProperty("line.separator"); - private static final ThreadLocal copyOutput = ThreadLocal.withInitial(HPSFFileHandler::getTempFile); static final Set EXCLUDES_HANDLE_ADD = StressTestUtils.unmodifiableHashSet( @@ -140,12 +138,10 @@ public class HPSFFileHandler extends POIFSFileHandler { try (InputStream stream = new FileInputStream(path)) { handleFile(stream, path); } - } - // a test-case to test this locally without executing the full TestAllFiles - @Test - void testExtractor() { - File file = new File("test-data/hpsf/TestBug44375.xls"); + File file = new File(path); assertDoesNotThrow(() -> handleExtracting(file)); + + handleAdditional(file); } } -- cgit v1.2.3