aboutsummaryrefslogtreecommitdiffstats
path: root/poi/src
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-12-30 19:39:24 +0000
committerDominik Stadler <centic@apache.org>2023-12-30 19:39:24 +0000
commit4d175324f2982b6b05fb7a5aea52831aeb2529e4 (patch)
treebd48bb1471fb8ffdc60701892b5f20d9c57a34a6 /poi/src
parentfb1aaf1e4e7fcf29d88e60d42ddf606061c35ce8 (diff)
downloadpoi-4d175324f2982b6b05fb7a5aea52831aeb2529e4.tar.gz
poi-4d175324f2982b6b05fb7a5aea52831aeb2529e4.zip
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent ClassCastException Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63736 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915003 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java4
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java1
2 files changed, 5 insertions, 0 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java
index 0674305b22..dabc789e8a 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java
@@ -36,6 +36,10 @@ public class AgileEncryptionInfoBuilder implements EncryptionInfoBuilder {
@Override
public void initialize(EncryptionInfo info, LittleEndianInput dis) throws IOException {
+ if (!(dis instanceof InputStream)) {
+ throw new IllegalArgumentException("Had unexpected type of input: " + (dis == null ? "<null>" : dis.getClass()));
+ }
+
EncryptionDocument ed = parseDescriptor((InputStream)dis);
info.setHeader(new AgileEncryptionHeader(ed));
info.setVerifier(new AgileEncryptionVerifier(ed));
diff --git a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
index 6e18940a72..b239be7923 100644
--- a/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
+++ b/poi/src/test/java/org/apache/poi/hssf/dev/BaseTestIteratingXLS.java
@@ -89,6 +89,7 @@ public abstract class BaseTestIteratingXLS {
// fuzzed binaries
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6322470200934400.xls", RuntimeException.class);
excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-4819588401201152.xls", RuntimeException.class);
+ excludes.put("clusterfuzz-testcase-minimized-POIHSSFFuzzer-6537773940867072.xls", RuntimeException.class);
return excludes;
}