From: Pauli <paul.dale@oracle.com>
Date: Tue, 7 May 2019 01:04:37 +0000 (+1000)
Subject: Coverity CID 1444953: Null pointer dereferences
X-Git-Tag: openssl-3.0.0-alpha1~2085
X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=1702c500b58414a936ce139853620b57547e6a0c;p=oweals%2Fopenssl.git

Coverity CID 1444953: Null pointer dereferences

Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/8888)
---

diff --git a/crypto/evp/evp_enc.c b/crypto/evp/evp_enc.c
index 0ccea3599e..44d88a1f04 100644
--- a/crypto/evp/evp_enc.c
+++ b/crypto/evp/evp_enc.c
@@ -338,6 +338,9 @@ int EVP_CipherInit_ex(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher,
 #ifndef OPENSSL_NO_ENGINE
  skip_to_init:
 #endif
+    if (ctx->cipher == NULL)
+        return 0;
+
     /* we assume block size is a power of 2 in *cryptUpdate */
     OPENSSL_assert(ctx->cipher->block_size == 1
                    || ctx->cipher->block_size == 8