Skip to content

Commit

Permalink
Bugfix: Reinitialise buffer lengths that have been used as outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Sep 19, 2015
1 parent 788038d commit 1973c73
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/tests.c
Expand Up @@ -1937,6 +1937,7 @@ void test_ecdsa_end_to_end(void) {
CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 1);
CHECK(secp256k1_ecdsa_verify(ctx, &signature[0], message, &pubkey) == 1);
/* Serialize/destroy/parse DER and verify again. */
siglen = 74;
CHECK(secp256k1_ecdsa_signature_serialize_der(ctx, sig, &siglen, &signature[0]) == 1);
sig[secp256k1_rand32() % siglen] += 1 + (secp256k1_rand32() % 255);
CHECK(secp256k1_ecdsa_signature_parse_der(ctx, &signature[0], sig, siglen) == 0 ||
Expand Down Expand Up @@ -2154,6 +2155,7 @@ void test_ecdsa_edge_cases(void) {
};
size_t outlen = 300;
CHECK(!secp256k1_ec_privkey_export(ctx, privkey, &outlen, seckey, 0));
outlen = 300;
CHECK(!secp256k1_ec_privkey_export(ctx, privkey, &outlen, seckey, 1));
}
}
Expand Down

0 comments on commit 1973c73

Please sign in to comment.