Skip to content

Commit

Permalink
Avoid signed overflow in MSVC AMR64 secp256k1_mul128
Browse files Browse the repository at this point in the history
  • Loading branch information
sipa committed Nov 17, 2022
1 parent 9b5f589 commit 3afce0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/int128_struct_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static SECP256K1_INLINE uint64_t secp256k1_umul128(uint64_t a, uint64_t b, uint6

static SECP256K1_INLINE int64_t secp256k1_mul128(int64_t a, int64_t b, int64_t* hi) {
*hi = __mulh(a, b);
return a * b;
return (uint64_t)a * (uint64_t)b;
}
# else
/* On x84_64 MSVC, use native _(u)mul128 for 64x64->128 multiplications. */
Expand Down

0 comments on commit 3afce0a

Please sign in to comment.