Skip to content

Commit 88d3ddb

Browse files
committed
Cygwin: dll_init: use SIZE_T instead of DWORD for size
The RegionSize member of the MEMORY_BASIC_INFORMATION struct is of type SIZE_T, and it may be larger than will fit in a DWORD (I observed 0x200000000). This resulted in an error due to trying to reserve 0 bytes from VirtualAllloc. Fixes: 8d777a1 ("* dll_init.cc (reserve_at, release_at): New functions.") Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258154.html Reported-by: Yuyi Wang <[email protected]> Signed-off-by: Jeremy Drake <[email protected]>
1 parent a89b9cb commit 88d3ddb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

winsup/cygwin/dll_init.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,7 @@ dll_list::track_self ()
633633
static PVOID
634634
reserve_at (PCWCHAR name, PVOID here, PVOID dll_base, DWORD dll_size)
635635
{
636-
DWORD size;
636+
SIZE_T size;
637637
MEMORY_BASIC_INFORMATION mb;
638638

639639
if (!VirtualQuery (here, &mb, sizeof (mb)))

winsup/cygwin/release/3.6.2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,6 @@ Fixes:
2828

2929
- Fix infinite exception loop on segmentation fault when strace-ing
3030
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258144.html
31+
32+
- Fix size truncation in dll_init reserve_at function.
33+
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258154.html

0 commit comments

Comments
 (0)