[PATCH 2/2] ntdll: Avoid truncating pointer to 32-bits in get_cpu_area().

Brendan Shanks wine at gitlab.winehq.org
Tue May 17 16:39:58 CDT 2022


From: Brendan Shanks <bshanks at codeweavers.com>

Signed-off-by: Brendan Shanks <bshanks at codeweavers.com>
---
 dlls/ntdll/unix/thread.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/thread.c b/dlls/ntdll/unix/thread.c
index 503230e4634..6d937675bcb 100644
--- a/dlls/ntdll/unix/thread.c
+++ b/dlls/ntdll/unix/thread.c
@@ -1111,7 +1111,7 @@ void *get_cpu_area( USHORT machine )
     case IMAGE_FILE_MACHINE_ARM64: align = TYPE_ALIGNMENT(ARM64_NT_CONTEXT); break;
     default: return NULL;
     }
-    return (void *)(((ULONG_PTR)(cpu + 1) + align - 1) & ~(align - 1));
+    return (void *)(((ULONG_PTR)(cpu + 1) + align - 1) & ~((ULONG_PTR)align - 1));
 }
 
 
-- 
GitLab

https://gitlab.winehq.org/wine/wine/-/merge_requests/85



More information about the wine-devel mailing list