Skip to content

cm-async: Cap read/write sizes on streams#13086

Merged
alexcrichton merged 3 commits intobytecodealliance:mainfrom
alexcrichton:cap-sizes
Apr 14, 2026
Merged

cm-async: Cap read/write sizes on streams#13086
alexcrichton merged 3 commits intobytecodealliance:mainfrom
alexcrichton:cap-sizes

Conversation

@alexcrichton
Copy link
Copy Markdown
Member

The spec mandates that stream operations cannot exceed 2**28 elements, but Wasmtime previously did not check for this limit. This meant that the guest could get silently corrupt answers when trying to operate on this many elements. This commit adds a new ItemCount newtype wrapper which is intended to be proof of an in-bounds count and then that's plumbed everywhere internally.

Closes #13023

The spec mandates that stream operations cannot exceed `2**28` elements,
but Wasmtime previously did not check for this limit. This meant that
the guest could get silently corrupt answers when trying to operate on
this many elements. This commit adds a new `ItemCount` newtype wrapper
which is intended to be proof of an in-bounds count and then that's
plumbed everywhere internally.

Closes bytecodealliance#13023
@alexcrichton alexcrichton requested a review from a team as a code owner April 13, 2026 23:23
@alexcrichton alexcrichton requested review from cfallin and dicej and removed request for a team and cfallin April 13, 2026 23:23
@github-actions github-actions bot added wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API. labels Apr 14, 2026
@alexcrichton alexcrichton requested a review from a team as a code owner April 14, 2026 19:10
@alexcrichton alexcrichton requested review from uweigand and removed request for a team April 14, 2026 19:10
@alexcrichton alexcrichton enabled auto-merge April 14, 2026 19:10
@alexcrichton alexcrichton added this pull request to the merge queue Apr 14, 2026
Merged via the queue into bytecodealliance:main with commit d4ce35c Apr 14, 2026
52 checks passed
@alexcrichton alexcrichton deleted the cap-sizes branch April 14, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

wasmtime:api Related to the API of the `wasmtime` crate itself wasmtime:c-api Issues pertaining to the C API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Futures/streams don't fully validate the item limit of 1<<28 items

2 participants