4
0
mirror of https://github.com/QuasarApp/openssl.git synced 2025-05-08 07:29:41 +00:00

Ensure that the negative flag is correct set for ASN1 integer types.

Reported by: Scott McPeak <scott.g.mcpeak@gmail.com>

Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/14768)
This commit is contained in:
Pauli 2021-04-04 13:58:22 +10:00 committed by Pauli
parent 0806698047
commit 581c4b1d53

@ -308,8 +308,10 @@ ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
c2i_ibuf(ret->data, &neg, *pp, len);
if (neg)
if (neg != 0)
ret->type |= V_ASN1_NEG;
else
ret->type &= ~V_ASN1_NEG;
*pp += len;
if (a != NULL)
@ -317,7 +319,7 @@ ASN1_INTEGER *ossl_c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp,
return ret;
err:
ERR_raise(ERR_LIB_ASN1, ERR_R_MALLOC_FAILURE);
if ((a == NULL) || (*a != ret))
if (a == NULL || *a != ret)
ASN1_INTEGER_free(ret);
return NULL;
}