From 147c96da67494e88d6bbdc44c52287c698a94190 Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Tue, 30 Jan 2024 21:01:46 +0000 Subject: 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 --- .../apache/poi/poifs/crypt/agile/AgileEncryptionVerifier.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'poi') 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); -- cgit v1.2.3