From 3afce0af7c00eb4c5ca6d303e36a48c91a800459 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Thu, 17 Nov 2022 09:44:10 -0500 Subject: [PATCH] Avoid signed overflow in MSVC AMR64 secp256k1_mul128 --- src/int128_struct_impl.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/int128_struct_impl.h b/src/int128_struct_impl.h index 5e64ac4..b5f8fb7 100644 --- a/src/int128_struct_impl.h +++ b/src/int128_struct_impl.h @@ -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. */