-
Notifications
You must be signed in to change notification settings - Fork 4
[WIP] Section validation #2
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
base: master
Are you sure you want to change the base?
Conversation
|
Below is a task list of all the validation required for the various sections found at https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md. I hope this gives a better overview of what needs to be done and that it eases reviewing efforts.
If I have missed any validation requirements please let me know and I'll add them. I will continue working on this for the next couple of days and update the task list accordingly. |
1 similar comment
|
Refactored test.py and added unit tests to make sure section validation fails as its supposed to. Hmm.. maybe I should break this PR down to one per section? @Bloodstalker |
|
that would make reading it easier for me but you don't have to. |
|
Alright, I will limit this PR to sections I have started working on and do the rest separately. |
|
ok. thank you. |
08106e8 to
f072bc9
Compare
Retrieve latest appended module for validation and break search loop when section is found.
* form is required to be func. * Each returns array is required to contain at most one element.
* All global imports are required to be immutable. Add classes with constants to improve code readability.
* Each export's name is required to be unique among all the exports' names. * Each export's index is required to be within the bounds of its associated index space. Also populate module index spaces in Module constructor.
* The array is required to be the same length as the Code Section array.
* The type of the value returned by init must be the same as desc's type.
* The index is required to be within the bounds of the Code Section array.
…heir index spaces
This commit adds tests and invalid wasm testfiles that checks the type section. The file invalid_form.wasm is based on testsuite/address.wasm and was edited to have the first entry of the type section include an invalid form (0x60 => 0x61). The file invalid_retcount.wasm is also based on testsuite/address.wasm and was edited to have the first type section entry include two return values instead of one.
The file incompatible_init_desc_type.wasm is based on the file testsuite/globals.wasm and has the first global declaration in the global section edited to change the global description type from 0x7f to 0x7e, thus making it incompatible with the type returned from the instantiation-time initializer.
Also make sure invalid_retcount.wasm test is properly formatted so parser doesn't crash.
f072bc9 to
85b409f
Compare
Some validation added for the Type, Import and Export sections. By no means complete, and sorry for the lack of tests so far.
Running out of time and wanted to get something up, so please feel free to leave this PR unmerged, and I could pick it up later.