Merge #627: Guard memcmp in tests against mixed size inputs.

248bffb Guard memcmp in tests against mixed size inputs. (Gregory Maxwell)

Pull request description:

  Reported by real-or-random.

  Fixes #623.

ACKs for commit 248bff:
  practicalswift:
    utACK 248bffb052

Tree-SHA512: 29867c79d2d6852f495334a5a9129c7feac2df639dd7f752067380689b0ce9f9b35e94524834c01e698df5c0b83dc9855204ec09f5dfe488a388b509c9b861d9
This commit is contained in:
Gregory Maxwell 2019-05-29 14:23:45 +00:00
commit ecc94abcc8
No known key found for this signature in database
GPG Key ID: EAB5AF94D9E9ABE7
1 changed files with 2 additions and 2 deletions

View File

@ -4455,7 +4455,7 @@ int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_
if (valid_der) {
ret |= (!roundtrips_der_lax) << 12;
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;
if (parsed_der) {
@ -4496,7 +4496,7 @@ int test_ecdsa_der_parse(const unsigned char *sig, size_t siglen, int certainly_
ret |= (roundtrips_der != roundtrips_openssl) << 7;
if (roundtrips_openssl) {
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
return ret;