Skip to content

Conversation

@sumleo
Copy link
Contributor

@sumleo sumleo commented Feb 11, 2026

Summary

  • WasmStore::instances was a std::vector<Instance>, but Frame holds Instance& references. Vector reallocation when adding new instances invalidates all frame references, leading to use-after-free.
  • Changed instances to std::deque<Instance>, which guarantees that references to existing elements are not invalidated by push_back/emplace_back.
  • Added a test that verifies Instance addresses remain stable after adding many instances while a frame holds a reference.

Test plan

  • InterpreterTest.InstanceReferenceStability — verifies that adding 100 instances does not relocate existing instances or invalidate frame references
  • All 55 interpreter tests pass

…rage

WasmStore::instances was a std::vector<Instance>, but Frame holds
Instance& references. Vector reallocation when adding new instances
would silently invalidate all frame references, leading to
use-after-free. Switch to std::deque which guarantees that references
to existing elements are not invalidated by push_back/emplace_back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant