Without this check, the return value is undefined.
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 )
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150635
Your paranoid android.
=== debian11b (64 bit WoW report) ===
kernel32: comm.c:1586: Test failed: Unexpected time 1001, expected around 500
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000000CF00E0, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
Jinoh Kang (@iamahuman) commented about dlls/ntdll/tests/file.c:
return; }
- res = pNtRemoveIoCompletionEx( h, info, 0, &count, &timeout, FALSE );
- ok( res == STATUS_INVALID_PARAMETER, "NtRemoveIoCompletionEx failed: %#lx\n", res );
Please test if and how `count` variable is overwritten.
Specifically, set `count = 0xdeadbeef;` beforehand and then check how the value changes.