lisenokdonbassenok opened PR #12480 from lisenokdonbassenok:fix/entity-set-insert-capacity to bytecodealliance:main:
Cause:
wasmtime_environ::collections::EntitySet::insertcalledtry_ensure_capacity(k.index()), whileCompoundBitSet::try_ensure_capacityguarantees capacity only for indices < n. This could leave the backing bitset without space for k.index() and force a later infallible ensure_capacity inside insert, breaking the fallible-allocation contract and potentially panicking on OOM.
Summary: UpdateEntitySet::insertto reserve capacity for indices 0..=k.index() by callingtry_ensure_capacity(k.index() + 1)so that all allocations during insertion go through the fallible path and correctly report OutOfMemory instead of panicking.
lisenokdonbassenok requested pchickey for a review on PR #12480.
lisenokdonbassenok requested wasmtime-core-reviewers for a review on PR #12480.
pchickey unassigned pchickey from PR #12480 fix: ensure EntitySet::insert reserves correct capacity.
pchickey requested fitzgen for a review on PR #12480.
alexcrichton commented on PR #12480:
Thanks! Could you add a test for this in this file? Ideally that'd be verified to fail before this PR but then pass after this PR
lisenokdonbassenok requested wasmtime-fuzz-reviewers for a review on PR #12480.
lisenokdonbassenok updated PR #12480.
lisenokdonbassenok commented on PR #12480:
Thanks! Could you add a test for this in this file? Ideally that'd be verified to fail before this PR but then pass after this PR
Added test
github-actions[bot] added the label fuzzing on PR #12480.
github-actions[bot] commented on PR #12480:
Subscribe to Label Action
cc @fitzgen
<details>
This issue or pull request has been labeled: "fuzzing"Thus the following users have been cc'd because of the following labels:
- fitzgen: fuzzing
To subscribe or unsubscribe from this label, edit the <code>.github/subscribe-to-label.json</code> configuration file.
Learn more.
</details>
alexcrichton submitted PR review.
alexcrichton added PR #12480 fix: ensure EntitySet::insert reserves correct capacity to the merge queue.
alexcrichton merged PR #12480.
alexcrichton removed PR #12480 fix: ensure EntitySet::insert reserves correct capacity from the merge queue.
fitzgen commented on PR #12480:
Thanks!
Last updated: Feb 24 2026 at 04:36 UTC