aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-10-27 10:08:04 +0000
committerDominik Stadler <centic@apache.org>2023-10-27 10:08:04 +0000
commit56eb1ccff6f271b63a2d91ff406e7d45ecb6c512 (patch)
tree2d8420a4561cd2ca4924cfbaecb8aab807a9c5ca /poi
parent5cc8b9958cbe1d1ca0fc378eb10e3123ed71e4ad (diff)
downloadpoi-56eb1ccff6f271b63a2d91ff406e7d45ecb6c512.tar.gz
poi-56eb1ccff6f271b63a2d91ff406e7d45ecb6c512.zip
Bug 66425: Avoid exceptions found via poi-fuzz
Fix one expected exception-text which is different on newer Java versions Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63143 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1913384 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
index fc2828ed0d..5540ba66cb 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java
@@ -69,7 +69,11 @@ public class AgileEncryptionHeader extends EncryptionHeader {
throw new EncryptedDocumentException("Unsupported chaining mode - "+ keyData.getCipherChaining());
}
- int hashSize = keyData.getHashSize();
+ Integer hashSizeObj = keyData.getHashSize();
+ if (hashSizeObj == null) {
+ throw new EncryptedDocumentException("Invalid hash size: " + hashSizeObj);
+ }
+ int hashSize = hashSizeObj;
HashAlgorithm ha = keyData.getHashAlgorithm();
setHashAlgorithm(ha);