Bug
In library/std/src/sys/net/connection/uefi/mod.rs:41-49, set_read_timeout and set_write_timeout do not reject Duration::ZERO. The public API contract documents: "An Err is returned if the zero Duration is passed to this method."
All other platform implementations (Unix, Windows, Hermit, SOLID, SGX, Xous) check for zero duration and return Err(io::Error::ZERO_TIMEOUT).
Impact
set_read_timeout(Some(Duration::ZERO)) silently succeeds on UEFI but causes all subsequent read/write operations to immediately return TimedOut, because the elapsed check (Instant::now().duration_since(start) >= t) is satisfied on the first iteration.
Fix
Add if matches!(t, Some(d) if d.is_zero()) { return Err(io::Error::ZERO_TIMEOUT); } before storing the timeout.
Bug
In
library/std/src/sys/net/connection/uefi/mod.rs:41-49,set_read_timeoutandset_write_timeoutdo not rejectDuration::ZERO. The public API contract documents: "An Err is returned if the zero Duration is passed to this method."All other platform implementations (Unix, Windows, Hermit, SOLID, SGX, Xous) check for zero duration and return
Err(io::Error::ZERO_TIMEOUT).Impact
set_read_timeout(Some(Duration::ZERO))silently succeeds on UEFI but causes all subsequent read/write operations to immediately returnTimedOut, because the elapsed check (Instant::now().duration_since(start) >= t) is satisfied on the first iteration.Fix
Add
if matches!(t, Some(d) if d.is_zero()) { return Err(io::Error::ZERO_TIMEOUT); }before storing the timeout.