Skip to content

Commit 94ae7cb

Browse files
committed
Moved a dereference so the null check will be before the dereferencing
1 parent fa33017 commit 94ae7cb

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/ecmult_impl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ static void secp256k1_ecmult_context_clear(secp256k1_ecmult_context *ctx) {
395395
* than the number of bits in the (absolute value) of the input.
396396
*/
397397
static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a, int w) {
398-
secp256k1_scalar s = *a;
398+
secp256k1_scalar s;
399399
int last_set_bit = -1;
400400
int bit = 0;
401401
int sign = 1;
@@ -408,6 +408,7 @@ static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a,
408408

409409
memset(wnaf, 0, len * sizeof(wnaf[0]));
410410

411+
s = *a;
411412
if (secp256k1_scalar_get_bits(&s, 255, 1)) {
412413
secp256k1_scalar_negate(&s, &s);
413414
sign = -1;

0 commit comments

Comments
 (0)