[PATCH 0/1] MR8257: kernel32/tests: Cancel IO before returning from function.
Otherwise we will have stack use-after-return when the pending IO completes. * * * Same as the one in hid/tests -- https://gitlab.winehq.org/wine/wine/-/merge_requests/8257
From: Yuxuan Shui <yshui(a)codeweavers.com> Otherwise we will have stack use-after-return when the pending IO completes. --- dlls/kernel32/tests/comm.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/dlls/kernel32/tests/comm.c b/dlls/kernel32/tests/comm.c index b4659034ddf..85cf13e5d98 100644 --- a/dlls/kernel32/tests/comm.c +++ b/dlls/kernel32/tests/comm.c @@ -1977,9 +1977,12 @@ static void test_WaitCommEvent(void) test_GetModemStatus(hcom); break; } - else + else if (last_event_time || after - before >= 10000) { - if (last_event_time || after - before >= 10000) goto done; + CancelIoEx(hcom, &ovl_wait); + ret = WaitForSingleObject(ovl_wait.hEvent, 500); + ok(ret == WAIT_OBJECT_0, "Wait for object failed\n"); + goto done; } } } while (after - before < 10000); @@ -2183,9 +2186,12 @@ static void test_read_write(void) ok(iob.Information == 1, "expected 1, got %Iu\n", iob.Information); goto done; } - else + else if (last_event_time || after - before >= 3000) { - if (last_event_time || after - before >= 3000) goto done; + CancelIoEx(hcom, &ovl_wait); + ret = WaitForSingleObject(ovl_wait.hEvent, 100); + ok(ret == WAIT_OBJECT_0, "Wait object failed\n"); + goto done; } } } while (after - before < 3000); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/8257
participants (2)
-
Yuxuan Shui -
Yuxuan Shui (@yshui)