From a18821d5b1d44db0e7c8335f338cc9876bec98cb Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Tue, 1 Sep 2020 18:15:21 -0700 Subject: [PATCH] Always initialize output coordinates in secp256k1_ge_set_gej --- src/group_impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/group_impl.h b/src/group_impl.h index 29017dc965242..d6031e58cfc64 100644 --- a/src/group_impl.h +++ b/src/group_impl.h @@ -115,10 +115,11 @@ static void secp256k1_ge_set_gej(secp256k1_ge *r, secp256k1_gej *a) { static void secp256k1_ge_set_gej_var(secp256k1_ge *r, secp256k1_gej *a) { secp256k1_fe z2, z3; - if (a->infinity) { + if (secp256k1_gej_is_infinity(a)) { secp256k1_ge_set_infinity(r); return; } + r->infinity = 0; secp256k1_fe_inv_var(&a->z, &a->z); secp256k1_fe_sqr(&z2, &a->z); secp256k1_fe_mul(&z3, &a->z, &z2);