diff options
Diffstat (limited to 'poi/src')
-rw-r--r-- | poi/src/main/java/org/apache/poi/poifs/crypt/agile/AgileEncryptionHeader.java | 6 |
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); |