From: Shane Lontis Date: Tue, 11 Aug 2020 05:41:54 +0000 (+1000) Subject: Fix coverity CID #1465531 - Negative return passed to a function param using size_t... X-Git-Tag: openssl-3.0.0-alpha7~506 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e499a64befa50bc2e7b9cb3173e8ac9b402fe1f9;p=thirdparty%2Fopenssl.git Fix coverity CID #1465531 - Negative return passed to a function param using size_t in asn1_item_digest_with_libctx() Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/12628) --- diff --git a/crypto/asn1/a_digest.c b/crypto/asn1/a_digest.c index 3e7b418a194..9211d7a9682 100644 --- a/crypto/asn1/a_digest.c +++ b/crypto/asn1/a_digest.c @@ -63,7 +63,7 @@ int asn1_item_digest_with_libctx(const ASN1_ITEM *it, const EVP_MD *md, EVP_MD *fetched_md = (EVP_MD *)md; i = ASN1_item_i2d(asn, &str, it); - if (str == NULL) + if (i < 0 || str == NULL) return 0; if (EVP_MD_provider(md) == NULL) {