coverity 1462565: Null pointer dereferences
authorPauli <paul.dale@oracle.com>
Sun, 26 Apr 2020 21:51:16 +0000 (07:51 +1000)
committerPauli <paul.dale@oracle.com>
Thu, 30 Apr 2020 10:21:16 +0000 (20:21 +1000)
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
(Merged from https://github.com/openssl/openssl/pull/11651)

crypto/evp/m_sigver.c

index 85c1fa281a7c04e0043e21924ac29f9a3a4b38b7..829b861ed2fe6e1fb454a914077119c9708f2e49 100644 (file)
@@ -317,11 +317,13 @@ int EVP_DigestSignUpdate(EVP_MD_CTX *ctx, const void *data, size_t dsize)
                                                       data, dsize);
 
  legacy:
-    /* do_sigver_init() checked that |digest_custom| is non-NULL */
-    if (pctx->flag_call_digest_custom
-        && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
-        return 0;
-    pctx->flag_call_digest_custom = 0;
+    if (pctx != NULL) {
+        /* do_sigver_init() checked that |digest_custom| is non-NULL */
+        if (pctx->flag_call_digest_custom
+            && !ctx->pctx->pmeth->digest_custom(ctx->pctx, ctx))
+            return 0;
+        pctx->flag_call_digest_custom = 0;
+    }
 
     return EVP_DigestUpdate(ctx, data, dsize);
 }