fix: avoid crash on OOM by safe-guarding uninitialized VM pointer#40
Closed
jtakakura wants to merge 1 commit intoclojurewasm:mainfrom
Closed
fix: avoid crash on OOM by safe-guarding uninitialized VM pointer#40jtakakura wants to merge 1 commit intoclojurewasm:mainfrom
jtakakura wants to merge 1 commit intoclojurewasm:mainfrom
Conversation
ab2e216 to
de0261d
Compare
de0261d to
2380e42
Compare
2380e42 to
6f0761f
Compare
8 tasks
chaploud
added a commit
that referenced
this pull request
Apr 24, 2026
Merge PR #40: OOM-safe VM pointer in loadLinked (jtakakura) + refinements
2 tasks
Contributor
|
Hi @jtakakura — this was too useful to leave in draft with #41 (Zig 0.16.0 migration) coming up, so I picked your commit up and shipped it as v1.9.1 via #44. Your commit stays intact at the base of the feature branch so contributor credit is preserved. What changed vs your version
Verified
v1.9.1 is tagged and pushed. ClojureWasm bump PR: clojurewasm/ClojureWasm#4. Thanks for the careful fix — the |
Contributor
|
Shipped as v1.9.1 via #44 — see comment above for details. Your commit preserved at the base of that branch, contributor credit maintained. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes a bug where, if allocator.create(Vm) fails due to OOM in WasmModule.loadLinked,
the returned module had an uninitialized vm field. This could cause undefined behavior
(e.g., crash in deinit) if the module was later cleaned up.
Now, vm is always set to null on OOM, and all accesses are guarded.
Additionally, invoke and related methods return error.ModuleNotFullyLoaded if vm is null.
All code and tests are updated to ensure safety in OOM scenarios.
Closes #39.