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

Wasm loader enhancement: check code size in code entry #3892

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

TianlongLiang
Copy link
Contributor

Add wasm loader check: in code entry, the code size should match the size of vec(locals) + expr, and expr should end with opcode end

…size of vec(locals) + expr, and expr should end with opcode end
@TianlongLiang
Copy link
Contributor Author

So how about I modify the loader logic as follows:

  1. check code size > len(vec(locals)) + 1 and check the END opcode at the end of the function body in load_function_section to early stop some mutated wasm file loader checking
  2. in wasm_loader_prepare_bytecode, at the end only check for unbalanced control flow structures now, since it won't be unmatched code size or missing end opcodes.

Copy link
Contributor

@wenyongh wenyongh left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@lum1n0us lum1n0us left a comment

Choose a reason for hiding this comment

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

LGTM

@lum1n0us lum1n0us merged commit bf78863 into bytecodealliance:main Nov 7, 2024
383 checks passed
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.

3 participants