]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
threads_win: fix improper cast to long * instead of LONG *
authorGeorgi Valkov <gvalkov@gmail.com>
Tue, 3 Sep 2024 07:13:34 +0000 (10:13 +0300)
committerTomas Mraz <tomas@openssl.org>
Thu, 5 Sep 2024 15:11:37 +0000 (17:11 +0200)
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 <gvalkov@gmail.com>
Reviewed-by: Tom Cosgrove <tom.cosgrove@arm.com>
Reviewed-by: Neil Horman <nhorman@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/25360)

crypto/threads_win.c

index bc430ef1b9e6c36e860af92b46a0742583ce7b4d..908661c64175ffc3ad94f39aff8211f9689496d7 100644 (file)
@@ -558,7 +558,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;
 }