Skip to content

Commit 475b7ad

Browse files
committed
Fix reserving executable memory as per allocation type in ClrVirtualAllocWithinRange()
Fixes #83818
1 parent 316d286 commit 475b7ad

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/coreclr/utilcode/util.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
369369
{
370370
NOTHROW;
371371
PRECONDITION(dwSize != 0);
372-
PRECONDITION(flAllocationType == MEM_RESERVE);
372+
PRECONDITION(flAllocationType == MEM_RESERVE); // ORed with MEM_RESERVE_EXECUTABLE on Unix
373373
}
374374
CONTRACTL_END;
375375

@@ -449,7 +449,7 @@ BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
449449
(mbInfo.RegionSize >= (SIZE_T) dwSize || mbInfo.RegionSize == 0))
450450
{
451451
// Try reserving the memory using VirtualAlloc now
452-
pResult = (BYTE*)ClrVirtualAlloc(tryAddr, dwSize, MEM_RESERVE, flProtect);
452+
pResult = (BYTE*)ClrVirtualAlloc(tryAddr, dwSize, flAllocationType, flProtect);
453453

454454
// Normally this will be successful
455455
//

0 commit comments

Comments
 (0)