diff options
author | Dominik Stadler <centic@apache.org> | 2024-01-30 21:01:46 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2024-01-30 21:01:46 +0000 |
commit | 147c96da67494e88d6bbdc44c52287c698a94190 (patch) | |
tree | 41d88fa6c941696cfdf7b83ca87b55f4f7800f7a /poi/src | |
parent | fef87cfa0a0ee142b27edb75b4089607e36e9e58 (diff) | |
download | poi-147c96da67494e88d6bbdc44c52287c698a94190.tar.gz poi-147c96da67494e88d6bbdc44c52287c698a94190.zip |
Bug 66425: Avoid exceptions found via poi-fuzz
Prevent a few NullPointerException
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65450 and
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63907 and
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=63727
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1915480 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi/src')
-rw-r--r-- | poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java index e65e679b35..add680a728 100644 --- a/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java +++ b/poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java @@ -51,10 +51,16 @@ public class AgileEncryptionVerifier extends EncryptionVerifier { setCipherAlgorithm(keyData.getCipherAlgorithm()); setKeySize(keyData.getKeyBits()); - int blockSize = keyData.getBlockSize(); + Integer blockSize = keyData.getBlockSize(); + if (blockSize == null) { + throw new IllegalArgumentException("blockSize not set"); + } setBlockSize(blockSize); - int hashSize = keyData.getHashSize(); + Integer hashSize = keyData.getHashSize(); + if (hashSize == null) { + throw new IllegalArgumentException("hashSize not set"); + } HashAlgorithm ha = keyData.getHashAlgorithm(); setHashAlgorithm(ha); |