Skip to content

Fix stdin over-read on seekable inputs - #14077

Merged
pchickey merged 1 commit into
bytecodealliance:mainfrom
subotac:fix/stdin-over-read
Aug 5, 2026
Merged

Fix stdin over-read on seekable inputs#14077
pchickey merged 1 commit into
bytecodealliance:mainfrom
subotac:fix/stdin-over-read

Conversation

@subotac

@subotac subotac commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Fixes #14065.

Avoid using std::io::Stdin's process-global buffer in the stdin worker because it can advance redirected seekable input beyond the number of bytes requested by a guest.

Use unbuffered OS reads on Unix and non-console Windows input while retaining StdinLock to preserve serialization with other process users. Add a subprocess regression test that reads one byte and verifies that the
shared file offset advances by exactly one byte.

@subotac
subotac requested a review from a team as a code owner August 4, 2026 14:19
@subotac
subotac requested review from dicej and removed request for a team August 4, 2026 14:19
@github-actions github-actions Bot added the wasi Issues pertaining to WASI label Aug 4, 2026
@pchickey
pchickey added this pull request to the merge queue Aug 5, 2026
Merged via the queue into bytecodealliance:main with commit 45220ce Aug 5, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasi Issues pertaining to WASI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wasmtime's stdin worker thread over-reads from a host fd backed by a regular file

2 participants