summaryrefslogtreecommitdiff
path: root/crypto/ec
diff options
context:
space:
mode:
authorx2018 <xkernel.wang@foxmail.com>2021-10-22 22:50:27 +0800
committerPauli <pauli@openssl.org>2021-10-27 08:38:30 +1000
commitd146811f6cce155eeb1a87396943c953acb08fb6 (patch)
tree64740a768140dd293a2d4e5475e097ce3c7300ab /crypto/ec
parent1682a8524652c4f1386852f0d0c1dec75895b7da (diff)
downloadopenssl-new-d146811f6cce155eeb1a87396943c953acb08fb6.tar.gz
add checks for the return values of BN_new(), sk_RSA_PRIME_INFO_new_reserve(),
EVP_PKEY_CTX_new_from_pkey() and EVP_CIPHER_CTX_new(). Otherwise may result in memory errors. Reviewed-by: Tomas Mraz <tomas@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> Reviewed-by: Paul Dale <pauli@openssl.org> (Merged from https://github.com/openssl/openssl/pull/16892) (cherry picked from commit 9dddcd90a1350fa63486cbf3226c3eee79f9aff5)
Diffstat (limited to 'crypto/ec')
-rw-r--r--crypto/ec/ec_asn1.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c
index 31519137c6..6323131a22 100644
--- a/crypto/ec/ec_asn1.c
+++ b/crypto/ec/ec_asn1.c
@@ -1223,7 +1223,8 @@ ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **psig, const unsigned char **ppin, long len)
sig->r = BN_new();
if (sig->s == NULL)
sig->s = BN_new();
- if (ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) {
+ if (sig->r == NULL || sig->s == NULL
+ || ossl_decode_der_dsa_sig(sig->r, sig->s, ppin, (size_t)len) == 0) {
if (psig == NULL || *psig == NULL)
ECDSA_SIG_free(sig);
return NULL;