From: Alex Henrie alexhenrie24@gmail.com
Without this check, the return value is undefined. --- dlls/ntdll/tests/file.c | 3 +++ dlls/ntdll/unix/sync.c | 2 ++ 2 files changed, 5 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c index 02bdf67796d..3ea0ac50c0f 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -1039,6 +1039,9 @@ static void test_set_io_completion(void) return; }
+ res = pNtRemoveIoCompletionEx( h, info, 0, &count, &timeout, FALSE ); + ok( res == STATUS_INVALID_PARAMETER, "NtRemoveIoCompletionEx failed: %#lx\n", res ); + count = 0xdeadbeef; res = pNtRemoveIoCompletionEx( h, info, 2, &count, &timeout, FALSE ); ok( res == STATUS_TIMEOUT, "NtRemoveIoCompletionEx failed: %#lx\n", res ); diff --git a/dlls/ntdll/unix/sync.c b/dlls/ntdll/unix/sync.c index d486b50001d..bc2aa0271a1 100644 --- a/dlls/ntdll/unix/sync.c +++ b/dlls/ntdll/unix/sync.c @@ -2081,6 +2081,8 @@ NTSTATUS WINAPI NtRemoveIoCompletionEx( HANDLE handle, FILE_IO_COMPLETION_INFORM
TRACE( "%p %p %u %p %p %u\n", handle, info, (int)count, written, timeout, alertable );
+ if (!count) return STATUS_INVALID_PARAMETER; + while (i < count) { SERVER_START_REQ( remove_completion )