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
This commit is contained in:
Dominik Stadler 2023-12-30 19:39:24 +00:00
parent fb1aaf1e4e
commit 4d175324f2
4 changed files with 5 additions and 0 deletions

View File

@ -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));

View File

@ -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;
}

Binary file not shown.