Skip to content

Conversation

@sumleo
Copy link
Contributor

@sumleo sumleo commented Feb 11, 2026

Summary

  • Interpreter::instantiate() iterates all globals without checking imported(), causing ExpressionIterator to be constructed with a null init expression for imported globals. This triggers an assertion failure in PostWalker::walk() (debug) or a null-pointer dereference (release).
  • Added a global->imported() check to skip imported globals during instantiation, matching the pattern used by walkModule() in wasm-traversal.h.
  • Added two test cases: one for a module with only imported globals, and one for a module mixing imported and local globals.

Test plan

  • InterpreterTest.ImportedGlobalI32 — verifies addInstance succeeds with an imported global
  • InterpreterTest.MixedImportedAndLocalGlobals — verifies a local global is correctly initialized when an imported global is also present
  • All 56 interpreter tests pass

…bals

instantiate() iterated all globals without checking imported(), causing
ExpressionIterator to be constructed with a null init expression. This
triggered an assertion failure in PostWalker::walk(). Skip imported
globals during instantiation, matching the pattern used by walkModule().
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