aboutsummaryrefslogtreecommitdiffstats
path: root/poi
diff options
context:
space:
mode:
authorDominik Stadler <centic@apache.org>2023-09-11 18:25:01 +0000
committerDominik Stadler <centic@apache.org>2023-09-11 18:25:01 +0000
commitdbd88084324d2716517197e76d1feb4b224e1773 (patch)
tree626f9d8fd2fae5abc8d7f6a88f1055e2892df01a /poi
parent482f4ca30df736de2ac72a5bb81841138b5ed6e8 (diff)
downloadpoi-dbd88084324d2716517197e76d1feb4b224e1773.tar.gz
poi-dbd88084324d2716517197e76d1feb4b224e1773.zip
Bug 66425: Avoid a NullPointerException found via oss-fuzz
We try to avoid throwing NullPointerException, but it was possible to trigger one here with a specially crafted input-file Should fix https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=62216 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912250 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'poi')
-rw-r--r--poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java b/poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
index 4f229e9a18..3698c57b7e 100644
--- a/poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
+++ b/poi/src/main/java/org/apache/poi/poifs/crypt/cryptoapi/CryptoAPIDecryptor.java
@@ -130,6 +130,9 @@ public class CryptoAPIDecryptor extends Decryptor {
}
protected static SecretKey generateSecretKey(String password, EncryptionVerifier ver) {
+ if (password == null) {
+ throw new IllegalArgumentException("Did not receive a password");
+ }
if (password.length() > 255) {
password = password.substring(0, 255);
}