authorgravatar for ypsvlq@gmail.comElaine Gibson <ypsvlq@gmail.com> 2026-08-01 22:43:06+01:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2026-08-02 12:04:20+02:00
log12dc2f261166fe901ed955a1e87fcf292e3b1b86
tree5f8ed6ba6d694ded540865660b850175f8dd6f0e
parent833105128485bf84a22f26506eb5e7b9bfa146a0

std: pass null for infinite NtWaitForSingleObject timeout

fixes #31954

3 files changed, 4 insertions(+), 8 deletions(-)

lib/std/Io/Threaded.zig+2-4
......@@ -15347,8 +15347,7 @@ fn childKillWindows(t: *Threaded, child: *process.Child, exit_code: windows.UINT
1534715347 _ = windows.ntdll.RtlReportSilentProcessExit(handle, @fromBackingInt(@intCast(exit_code)));
1534815348 switch (windows.ntdll.NtTerminateProcess(handle, @fromBackingInt(@intCast(exit_code)))) {
1534915349 .SUCCESS, .PROCESS_IS_TERMINATING => {
15350 const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER);
15351 _ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, &infinite_timeout);
15350 _ = windows.ntdll.NtWaitForSingleObject(handle, .FALSE, null);
1535215351 childCleanupWindows(child);
1535315352 },
1535415353 .ACCESS_DENIED => {
......@@ -15371,8 +15370,7 @@ fn childWaitWindows(child: *process.Child) process.Child.WaitError!process.Child
1537115370 const handle = child.id.?;
1537215371
1537315372 const alertable_syscall: AlertableSyscall = try .start();
15374 const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER);
15375 while (true) switch (windows.ntdll.NtWaitForSingleObject(handle, .TRUE, &infinite_timeout)) {
15373 while (true) switch (windows.ntdll.NtWaitForSingleObject(handle, .TRUE, null)) {
1537615374 windows.NTSTATUS.WAIT_0 => break alertable_syscall.finish(),
1537715375 .USER_APC, .ALERTED, .TIMEOUT => {
1537815376 try alertable_syscall.checkCancel();
lib/std/Thread.zig+1-2
......@@ -639,8 +639,7 @@ const WindowsThreadImpl = struct {
639639 }
640640
641641 fn join(self: Impl) void {
642 const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER);
643 switch (windows.ntdll.NtWaitForSingleObject(self.thread.thread_handle, .FALSE, &infinite_timeout)) {
642 switch (windows.ntdll.NtWaitForSingleObject(self.thread.thread_handle, .FALSE, null)) {
644643 windows.NTSTATUS.WAIT_0 => {},
645644 else => |status| windows.unexpectedStatus(status) catch unreachable,
646645 }
test/standalone/windows_argv/fuzz.zig+1-2
......@@ -147,8 +147,7 @@ fn spawnVerify(verify_path: [:0]const u16, cmd_line: [:0]const u16) !windows.DWO
147147 break :spawn proc_info.hProcess;
148148 };
149149 defer windows.CloseHandle(child_proc);
150 const infinite_timeout: windows.LARGE_INTEGER = std.math.minInt(windows.LARGE_INTEGER);
151 switch (windows.ntdll.NtWaitForSingleObject(child_proc, .FALSE, &infinite_timeout)) {
150 switch (windows.ntdll.NtWaitForSingleObject(child_proc, .FALSE, null)) {
152151 windows.NTSTATUS.WAIT_0 => {},
153152 .TIMEOUT => return error.WaitTimeOut,
154153 else => |status| return windows.unexpectedStatus(status),