Skip to content

wast: ignore multiple start sections (already detected in wasmparser) #2133

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

Merged
merged 1 commit into from
Apr 10, 2025

Conversation

keithw
Copy link
Contributor

@keithw keithw commented Apr 10, 2025

The wast crate has a validate function (on Wats, Modules and Components), but:

  • it's not getting called totally consistently (Wat parse calls it, but Module parse_without_module_keyword and Component parse_without_component_keyword don't call it, and those are used instead for some of the wast directives -- this led to some confusing debugging!)
  • it doesn't do a ton (it checks for multiple start sections, which wasmparser is also capable of detecting)
  • I think it would be safer to put all the eggs in wasmparser's basket to reduce the risk that there's an error condition that only gets caught when a module/component is expressed in the text format

This PR eliminates the validate function and defers detection of the error to the binary format.

@keithw keithw force-pushed the wast-dont-validate branch from a165b0f to 74b30d1 Compare April 10, 2025 03:29
@keithw keithw force-pushed the wast-dont-validate branch from 74b30d1 to a583c36 Compare April 10, 2025 03:33
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

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

Huh I'm not actually sure where this came from... I know I had a fair number of misunderstandings about the text format when I first wrote all this and maybe that's what happened here... In any case thanks!

@alexcrichton alexcrichton added this pull request to the merge queue Apr 10, 2025
Merged via the queue into bytecodealliance:main with commit f05bc36 Apr 10, 2025
32 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.

2 participants