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

Imports of undefined type should throw #20

Closed
ballercat opened this issue Dec 14, 2017 · 0 comments
Closed

Imports of undefined type should throw #20

ballercat opened this issue Dec 14, 2017 · 0 comments

Comments

@ballercat
Copy link
Owner

Overview

There is undefined behavior(heh) when importing functions which do not have a matching type definition in the file. Nothing breaks though, it seems like the function gets a random(?) function index assigned to it. I'm not sure how this is working, but this should be a syntax error.

Types are one of the first sections of a WebAssembly module. When we import from the environment we only have an identifier for the type; it get's written as a placeholder to the type index. Once we encounter the type definition, we patch it. When we don't though, we encode the placeholder type, whatever that may be.

Expected behavior

Undefined types should through

Notes

The work for this is slightly tricky since we never parse the tokens twice. And this should be part of a stand-alone sanity check/validation once we are done parsing all of the tokens. This could be the first validation. So far these usually end up in runtime errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant