-
Notifications
You must be signed in to change notification settings - Fork 828
Fuzz the Table from JS #7042
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
Fuzz the Table from JS #7042
Conversation
| // If a "table" export already exists, skip fuzzing these imports, as the | ||
| // current export may not contain a valid table for it. | ||
| if (wasm.getExportOrNull("table")) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In which case can this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fuzzer can start with inputs from the test suite and elsewhere, and initial content like that can contain a "table" export. Basically, the fuzzer needs to be able to start from any valid wasm file, so we have to handle corner cases like that.
|
|
||
| // Table operations. | ||
| 'table-get': (index) => { | ||
| return exports.table.get(index >>> 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the reason for shifting the index by 0? (I googled it and it says it makes it a number, but I don't understand why it is necessary...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the >>> operator is an unsigned operation, so this forces it to be a 32-bit unsigned number. That is the same way that the wasm table.get operation treats the input, so this is done to match that.
Continues the work from #7027 which added throwing from JS, this adds
table get/set operations from JS, to further increase our coverage of
Wasm/JS interactions (the table can be used from both sides).