From 03bfc07b9ee0ad0698ff9d96b79b4b21ca2eb705 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Sun, 26 Oct 2014 06:50:21 -0700 Subject: [PATCH] Avoid uninitialized access in secp256k1_gej_double --- src/group_impl.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/group_impl.h b/src/group_impl.h index 0fed94535c3..59eaff57d1e 100644 --- a/src/group_impl.h +++ b/src/group_impl.h @@ -190,9 +190,14 @@ int static secp256k1_ge_is_valid(const secp256k1_ge_t *a) { } void static secp256k1_gej_double(secp256k1_gej_t *r, const secp256k1_gej_t *a) { + if (a->infinity) { + r->infinity = 1; + return; + } + secp256k1_fe_t t5 = a->y; secp256k1_fe_normalize(&t5); - if (a->infinity || secp256k1_fe_is_zero(&t5)) { + if (secp256k1_fe_is_zero(&t5)) { r->infinity = 1; return; }