Module: wine Branch: master Commit: 1afb369380ec2a5998ebe235c6def42632b64ae2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1afb369380ec2a5998ebe235c6...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Wed May 31 22:48:45 2017 +0900
ntdll: Zero bits parameter must be less than 21.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/tests/virtual.c | 2 -- dlls/ntdll/virtual.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c index d66644b..7366ef1 100644 --- a/dlls/kernel32/tests/virtual.c +++ b/dlls/kernel32/tests/virtual.c @@ -400,7 +400,6 @@ static void test_VirtualAlloc(void) addr2 = NULL; status = pNtAllocateVirtualMemory(GetCurrentProcess(), &addr2, 22, &size, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE); - todo_wine ok(status == STATUS_INVALID_PARAMETER_3, "NtAllocateVirtualMemory returned %08x\n", status); if (status == STATUS_SUCCESS) ok(VirtualFree(addr2, 0, MEM_RELEASE), "VirtualFree failed\n");
@@ -1168,7 +1167,6 @@ static void test_NtMapViewOfSection(void) ptr2 = NULL; size = 0; status = pNtMapViewOfSection( mapping, hProcess, &ptr2, 22, 0, &offset, &size, 1, 0, PAGE_READWRITE ); - todo_wine ok( status == STATUS_INVALID_PARAMETER_4, "NtMapViewOfSection returned %x\n", status ); if (status == STATUS_SUCCESS) { diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index e826fa0..ee9c8d0 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -279,6 +279,7 @@ static inline UINT_PTR get_mask( ULONG zero_bits ) { if (!zero_bits) return 0xffff; /* allocations are aligned to 64K by default */ if (zero_bits < page_shift) zero_bits = page_shift; + if (zero_bits > 21) return 0; return (1 << zero_bits) - 1; }
@@ -1885,6 +1886,7 @@ NTSTATUS WINAPI NtAllocateVirtualMemory( HANDLE process, PVOID *ret, ULONG zero_ TRACE("%p %p %08lx %x %08x\n", process, *ret, size, type, protect );
if (!size) return STATUS_INVALID_PARAMETER; + if (!mask) return STATUS_INVALID_PARAMETER_3;
if (process != NtCurrentProcess()) { @@ -2550,7 +2552,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p
/* Check parameters */
- if (*addr_ptr && zero_bits) + if ((*addr_ptr && zero_bits) || !mask) return STATUS_INVALID_PARAMETER_4;
#ifndef _WIN64