From cc4931b3258ec764f0769ee573ed8a2989664d3a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 27 Oct 2025 17:03:16 -0700 Subject: [PATCH] std.Io.Threaded: fix 32-bit overflow in lookupDns be a little more careful with nanoseconds --- lib/std/Io/Threaded.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/std/Io/Threaded.zig b/lib/std/Io/Threaded.zig index dae9089e90..b3646cb88e 100644 --- a/lib/std/Io/Threaded.zig +++ b/lib/std/Io/Threaded.zig @@ -5235,7 +5235,7 @@ fn lookupDns( var now_ts = try clock.now(t_io); const final_ts = now_ts.addDuration(.fromSeconds(rc.timeout_seconds)); const attempt_duration: Io.Duration = .{ - .nanoseconds = std.time.ns_per_s * @as(usize, rc.timeout_seconds) / rc.attempts, + .nanoseconds = (std.time.ns_per_s / rc.attempts) * @as(i96, rc.timeout_seconds), }; send: while (now_ts.nanoseconds < final_ts.nanoseconds) : (now_ts = try clock.now(t_io)) {