From 4861f83686af25d1c898d06b140d3019a6c28461 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 18 Nov 2014 12:36:20 +0100 Subject: [PATCH] Test whether recovered public keys are not infinity Fixes a bug discovered by Sergio Demian Lerner. --- src/ecdsa_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ecdsa_impl.h b/src/ecdsa_impl.h index 57e9978efa..4c05ec39f8 100644 --- a/src/ecdsa_impl.h +++ b/src/ecdsa_impl.h @@ -128,7 +128,7 @@ static int secp256k1_ecdsa_sig_recover(const secp256k1_ecdsa_sig_t *sig, secp256 secp256k1_num_free(&rn); secp256k1_num_free(&u1); secp256k1_num_free(&u2); - return 1; + return !secp256k1_gej_is_infinity(&qj); } static int secp256k1_ecdsa_sig_verify(const secp256k1_ecdsa_sig_t *sig, const secp256k1_ge_t *pubkey, const secp256k1_num_t *message) {