[PATCH v4 3/6] kernel32/tests: Add tests for NtAllocateVirtualMemory with size_ptr == NULL
Huw Davies
huw at codeweavers.com
Wed May 29 04:47:16 CDT 2019
On Tue, May 28, 2019 at 12:15:15PM +0200, Rémi Bernon wrote:
> Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
> ---
> dlls/kernel32/tests/virtual.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/dlls/kernel32/tests/virtual.c b/dlls/kernel32/tests/virtual.c
> index 1778509d2ac..79eed345910 100644
> --- a/dlls/kernel32/tests/virtual.c
> +++ b/dlls/kernel32/tests/virtual.c
> @@ -442,6 +442,11 @@ static void test_VirtualAlloc(void)
> addr2 = VirtualAlloc(addr1, 0x1000, MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
> ok(addr2 == addr1, "VirtualAlloc returned %p, expected %p\n", addr2, addr1);
>
> + /* size_ptr should not be NULL */
> + status = pNtAllocateVirtualMemory(GetCurrentProcess(), NULL, 0, NULL,
> + MEM_RESERVE | MEM_COMMIT, PAGE_EXECUTE_READWRITE);
> + ok(status == STATUS_ACCESS_VIOLATION, "NtAllocateVirtualMemory returned %08x\n", status);
> +
> /* allocation conflicts because of 64k align */
> size = 0x1000;
> addr2 = (char *)addr1 + 0x1000;
Adding these sort of parameter checking tests (and implementing their
behaviour) is generally not useful. Please wait until you find an
application which relies on this (I suspect it'll be a long wait!).
But also this causes the tests to crash. You should test the tests
after each patch in the series.
../../../tools/runtest -q -P wine -T ../../.. -M kernel32.dll -p kernel32_test.exe virtual && touch virtual.ok
wine: Unhandled page fault on read access to 0x00000000 at address 0x7bcc4a86 (thread 0009), starting debugger...
Unhandled exception: page fault on read access to 0x00000000 in 32-bit code (0x7bcc4a86).
Register dump:
CS:0023 SS:002b DS:002b ES:002b FS:0063 GS:006b
EIP:7bcc4a86 ESP:0096fa50 EBP:0096fba8 EFLAGS:00010206( R- -- I - -P- )
EAX:00000040 EBX:ffffffff ECX:00000000 EDX:00635ffc
ESI:00000000 EDI:00003000
Stack dump:
0x0096fa50: 00000000 00000021 0096fb48 7bcc549b
0x0096fa60: 7bd23260 00000000 0096fb48 00000000
0x0096fa70: 00000000 00a30000 0096fb98 00000000
0x0096fa80: 00000000 00000000 0096fb78 7bcc53ba
0x0096fa90: 00000058 0096fadc 0096fab4 00000007
0x0096faa0: 00000004 00230000 0096fbc8 00000000
Backtrace:
=>0 0x7bcc4a86 NtAllocateVirtualMemory+0x36(process=<is not available>, ret=<is not available>, zero_bits=<is not available>, size_ptr=<is not available>, type=<is not available>, protect=<is not available>) [/home/daviesh/wine/dlls/ntdll/virtual.c:2466] in ntdll (0x0096fba8)
1 0x005035df test_VirtualAlloc+0x1e1e() [/home/daviesh/wine/dlls/kernel32/tests/virtual.c:446] in kernel32_test (0x0096fc38)
2 0x0050ff5b func_virtual+0x130a() [/home/daviesh/wine/dlls/kernel32/tests/virtual.c:4521] in kernel32_test (0x0096fd28)
3 0x0051f74d main+0x2ac(argc=<is not available>, argv=<is not available>) [/home/daviesh/wine/dlls/kernel32/tests/../../../include/wine/test.h:617] in kernel32_test (0x0096fdf8)
4 0x004013e3 buf+0x4013e2() in kernel32_test (0x0096fed0)
5 0x7b481c32 call_process_entry+0x11() in kernel32 (0x0096fee8)
6 0x7b483d24 start_process+0x163(entry=<is not available>, peb=<is not available>) [/home/daviesh/wine/dlls/kernel32/process.c:1257] in kernel32 (0x0096ffd8)
7 0x7b481c3e start_process_wrapper+0x9() in kernel32 (0x0096ffec)
Huw.
More information about the wine-devel
mailing list