Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core) Avoid crashing when missing host functions are allowed #1128

Merged
merged 6 commits into from
Jan 10, 2020

Conversation

Hywan
Copy link
Contributor

@Hywan Hywan commented Jan 9, 2020

Fix #1118.
Address #1121.

This PR fixes 2 things:

  • When droping the import backing, check that vm::FuncCtx isn't null before dropping it,
  • Use an always_trap as a placeholder host function when a host function is missing.

@Hywan Hywan added bug Something isn't working 🎉 enhancement New feature! 📦 lib-deprecated About the deprecated crates 🧪 tests I love tests labels Jan 9, 2020
@Hywan Hywan requested a review from bjfish as a code owner January 9, 2020 14:18
Copy link
Contributor

@MarkMcCaskey MarkMcCaskey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! Just want you to double check the public API changes and make sure we're at least aware of any breaking changes happening here

/// Get the underlying func pointer.
pub fn get_vm_func(&self) -> NonNull<vm::Func> {
self.func
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a breaking change?

Copy link
Contributor Author

@Hywan Hywan Jan 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop. It was implemented for Func<Kind = Wasm, …> only, now it's implemented for Kind = Wasm and Kind = Host.

@Hywan
Copy link
Contributor Author

Hywan commented Jan 10, 2020

bors r+

bors bot added a commit that referenced this pull request Jan 10, 2020
1128: fix(runtime-core) Avoid crashing when missing host functions are allowed r=Hywan a=Hywan

Fix #1118. #1121 can be merged after

This PR fixes 2 things:

* When droping the import backing, check that `vm::FuncCtx` isn't null before dropping it,
* Use an `always_trap` as a placeholder host function when a host function is missing.

Co-authored-by: Ivan Enderlin <ivan.enderlin@hoa-project.net>
@bors
Copy link
Contributor

bors bot commented Jan 10, 2020

Build succeeded

@bors bors bot merged commit 43742cf into wasmerio:master Jan 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working 🎉 enhancement New feature! 📦 lib-deprecated About the deprecated crates 🧪 tests I love tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

allow_missing_functions doesn't work in release mode
2 participants