From: Georgi Valkov Date: Tue, 3 Sep 2024 07:13:34 +0000 (+0300) Subject: threads_win: fix improper cast to long * instead of LONG * X-Git-Tag: openssl-3.1.8~147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=135fa8dbe3d66b5186217f5d8cd6dbac4c94ec4c;p=thirdparty%2Fopenssl.git threads_win: fix improper cast to long * instead of LONG * InterlockedExchangeAdd expects arguments of type LONG *, LONG but the int arguments were improperly cast to long *, long Note: - LONG is always 32 bit - long is 32 bit on Win32 VC x86/x64 and MingW-W64 - long is 64 bit on cygwin64 Signed-off-by: Georgi Valkov Reviewed-by: Tom Cosgrove Reviewed-by: Neil Horman Reviewed-by: Richard Levitte Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/25360) (cherry picked from commit b0ed90cc30a573acb9b27186babc616be482afcb) --- diff --git a/crypto/threads_win.c b/crypto/threads_win.c index dbeda74d73a..43f36ee6a33 100644 --- a/crypto/threads_win.c +++ b/crypto/threads_win.c @@ -212,7 +212,8 @@ int CRYPTO_THREAD_compare_id(CRYPTO_THREAD_ID a, CRYPTO_THREAD_ID b) int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) { - *ret = (int)InterlockedExchangeAdd((long volatile *)val, (long)amount) + amount; + *ret = (int)InterlockedExchangeAdd((LONG volatile *)val, (LONG)amount) + + amount; return 1; }