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
}
CTPoint2D off = xfrm.getOff();
+ if (off == null) {
+ throw new IllegalArgumentException("Could not retrieve Off from the XML object");
+ }
double x = Units.toPoints(POIXMLUnits.parseLength(off.xgetX()));
double y = Units.toPoints(POIXMLUnits.parseLength(off.xgetY()));
CTPositiveSize2D ext = xfrm.getExt();
* 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
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();
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);