diff options
author | Dominik Stadler <centic@apache.org> | 2023-12-30 19:39:24 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2023-12-30 19:39:24 +0000 |
commit | 4d175324f2982b6b05fb7a5aea52831aeb2529e4 (patch) | |
tree | bd48bb1471fb8ffdc60701892b5f20d9c57a34a6 /poi/src/main | |
parent | fb1aaf1e4e7fcf29d88e60d42ddf606061c35ce8 (diff) | |
download | poi-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/main')
-rw-r--r-- | poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionInfoBuilder.java | 4 |
1 files changed, 4 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)); |