Skip to content

UEFI: set_read_timeout/set_write_timeout silently accepts Duration::ZERO #463

@SebTardif

Description

@SebTardif

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-wrongWrong result or data corruptionO-uefiUEFI platformbugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions