Moved a dereference so the null check will be before the dereferencing

This commit is contained in:
Elichai Turkel 2019-07-02 19:18:56 -04:00
parent fa33017135
commit 94ae7cbf83
No known key found for this signature in database
GPG Key ID: 9383CDE9E8E66A7F

View File

@ -395,7 +395,7 @@ static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx) {
* than the number of bits in the (absolute value) of the input. * than the number of bits in the (absolute value) of the input.
*/ */
static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) { static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) {
secp256k1_scalar s = *a; secp256k1_scalar s;
int last_set_bit = -1; int last_set_bit = -1;
int bit = 0; int bit = 0;
int sign = 1; int sign = 1;
@ -408,6 +408,7 @@ static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a,
memset(wnaf, 0, len * sizeof(wnaf[0])); memset(wnaf, 0, len * sizeof(wnaf[0]));
s = *a;
if (secp256k1_scalar_get_bits(&s, 255, 1)) { if (secp256k1_scalar_get_bits(&s, 255, 1)) {
secp256k1_scalar_negate(&s, &s); secp256k1_scalar_negate(&s, &s);
sign = -1; sign = -1;