mirror of
https://github.com/status-im/secp256k1.git
synced 2025-02-24 11:48:18 +00:00
Guard memcmp in tests against mixed size inputs.
Reported by real-or-random. Fixes #623.
This commit is contained in:
parent
36698dcfee
commit
248bffb052
@ -4315,7 +4315,7 @@ int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_
|
|||||||
if (valid_der) {
|
if (valid_der) {
|
||||||
ret |= (!roundtrips_der_lax) << 12;
|
ret |= (!roundtrips_der_lax) << 12;
|
||||||
ret |= (len_der != len_der_lax) << 13;
|
ret |= (len_der != len_der_lax) << 13;
|
||||||
ret |= (memcmp(roundtrip_der_lax, roundtrip_der, len_der) != 0) << 14;
|
ret |= ((len_der != len_der_lax) || (memcmp(roundtrip_der_lax, roundtrip_der, len_der) != 0)) << 14;
|
||||||
}
|
}
|
||||||
ret |= (roundtrips_der != roundtrips_der_lax) << 15;
|
ret |= (roundtrips_der != roundtrips_der_lax) << 15;
|
||||||
if (parsed_der) {
|
if (parsed_der) {
|
||||||
@ -4356,7 +4356,7 @@ int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_
|
|||||||
ret |= (roundtrips_der != roundtrips_openssl) << 7;
|
ret |= (roundtrips_der != roundtrips_openssl) << 7;
|
||||||
if (roundtrips_openssl) {
|
if (roundtrips_openssl) {
|
||||||
ret |= (len_der != (size_t)len_openssl) << 8;
|
ret |= (len_der != (size_t)len_openssl) << 8;
|
||||||
ret |= (memcmp(roundtrip_der, roundtrip_openssl, len_der) != 0) << 9;
|
ret |= ((len_der != (size_t)len_openssl) || (memcmp(roundtrip_der, roundtrip_openssl, len_der) != 0)) << 9;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user