[PATCH 1/2] ws2_32: Cast timeval fields to LONGLONG before multiplying.

Zebediah Figura zfigura at codeweavers.com
Thu Jan 13 19:16:14 CST 2022


WXWORK passes 300 seconds, which overflows 32-bit multiplication.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52383
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
---
 dlls/ws2_32/socket.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c
index f0c8f4a72d0..87fa3629b1c 100644
--- a/dlls/ws2_32/socket.c
+++ b/dlls/ws2_32/socket.c
@@ -2409,7 +2409,7 @@ int WINAPI select( int count, fd_set *read_ptr, fd_set *write_ptr,
     }
 
     if (timeout)
-        params->timeout = timeout->tv_sec * -10000000 + timeout->tv_usec * -10;
+        params->timeout = (LONGLONG)timeout->tv_sec * -10000000 + (LONGLONG)timeout->tv_usec * -10;
     else
         params->timeout = TIMEOUT_INFINITE;
 
-- 
2.34.1




More information about the wine-devel mailing list