diff options
author | Dominik Stadler <centic@apache.org> | 2023-08-07 12:09:31 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-08-07 12:09:31 +0000 |
commit | f6b1435db196b4a2d7079191a15a4018915f70a5 (patch) | |
tree | 61b99deb8af4911e041e7d058b750f68516224d2 /poi-integration/src | |
parent | ed12f1bb499a09f69d43412fe010cd26ba1e40d6 (diff) | |
download | poi-f6b1435db196b4a2d7079191a15a4018915f70a5.tar.gz poi-f6b1435db196b4a2d7079191a15a4018915f70a5.zip |
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
Diffstat (limited to 'poi-integration/src')
-rw-r--r-- | poi-integration/src/test/java/org/apache/poi/stress/HPSFFileHandler.java | 10 |
1 files changed, 3 insertions, 7 deletions
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<File> copyOutput = ThreadLocal.withInitial(HPSFFileHandler::getTempFile); static final Set<String> 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); } } |