aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-09-21 15:06:28 +0000
committerDominik Stadler <centic@apache.org>2023-09-21 15:06:28 +0000
commitc79fb75cbccccfa65aa7343a793f6284dd7510f0 (patch)
treef5d1d00384d4710d31395fc04fca24f2f29e50c2 /poi
parenta9aa91a9ed443e73b39cf038bea9ea7a586661f8 (diff)
downloadpoi-c79fb75cbccccfa65aa7343a793f6284dd7510f0.tar.gz
poi-c79fb75cbccccfa65aa7343a793f6284dd7510f0.zip
Bug 66425: Avoid exceptions found via poi-fuzz
We try to avoid throwing NullPointerException, ClassCastExceptions and StackOverflowException, but it was possible to trigger them Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62548 and https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62564 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912464 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java2
1 files changed, 1 insertions, 1 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java
index 5ed0d14db3..42c80ecfd7 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/KeyData.java
@@ -60,7 +60,7 @@ public class KeyData {
blockSize = getIntAttr(keyData, "blockSize");
keyBits = getIntAttr(keyData, "keyBits");
hashSize = getIntAttr(keyData, "hashSize");
- cipherAlgorithm = CipherAlgorithm.fromXmlId(keyData.getAttribute("cipherAlgorithm"), keyBits);
+ cipherAlgorithm = CipherAlgorithm.fromXmlId(keyData.getAttribute("cipherAlgorithm"), keyBits == null ? -1 : keyBits);
cipherChaining = ChainingMode.fromXmlId(keyData.getAttribute("cipherChaining"));
hashAlgorithm = HashAlgorithm.fromEcmaId(keyData.getAttribute("hashAlgorithm"));
if (cipherAlgorithm == null || cipherChaining == null || hashAlgorithm == null) {