Skip to content

Commit

Permalink
Moved a dereference so the null check will be before the dereferencing
Browse files Browse the repository at this point in the history
  • Loading branch information
elichai committed Jul 3, 2019
1 parent fa33017 commit 94ae7cb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ecmult_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
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 bit = 0;
int sign = 1;
Expand All @@ -408,6 +408,7 @@ static int secp256k1_ecmult_wnaf(int *wnaf, int len, const secp256k1_scalar *a,

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

s = *a;
if (secp256k1_scalar_get_bits(&s, 255, 1)) {
secp256k1_scalar_negate(&s, &s);
sign = -1;
Expand Down

0 comments on commit 94ae7cb

Please sign in to comment.