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-scratchpad | |
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-scratchpad')
-rw-r--r-- | poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java index 86f9956824..bf73030fe2 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/HWPFDocumentCore.java @@ -88,7 +88,7 @@ public abstract class HWPFDocumentCore extends POIDocument { * Size of the not encrypted part of the FIB */ protected static final int FIB_BASE_LEN = 68; - + /** * [MS-DOC] 2.2.6.2/3 Office Binary Document ... Encryption: * "... The block number MUST be set to zero at the beginning of the stream and @@ -283,6 +283,9 @@ public abstract class HWPFDocumentCore extends POIDocument { EncryptionMode em = fibBase.isFObfuscated() ? EncryptionMode.xor : null; EncryptionInfo ei = new EncryptionInfo(leis, em); Decryptor dec = ei.getDecryptor(); + if (dec == null) { + throw new EncryptedDocumentException("Invalid encryption info, did not get a matching decryptor"); + } dec.setChunkSize(RC4_REKEYING_INTERVAL); try { String pass = Biff8EncryptionKey.getCurrentUserPassword(); |