[fuzz] Fix order of arguments passed in to wasm-spec-interpreter#4672
Conversation
In bytecodealliance#4671, the meta-differential fuzz target was finding errors when running certain Wasm modules (specifically `shr_s` in that case). @conrad-watt diagnosed the issue as a missing reversal in the operands passed to the spec interpreter. This change fixes bytecodealliance#4671 and adds an additional unit test to keep it fixed.
| parameters if they exist, otherwise use default (zeroed) values. *) | ||
| let interpret_exn module_bytes opt_params = | ||
| let opt_params_ = Option.map (List.map convert_to_wasm) opt_params in | ||
| let opt_params_ = Option.map (List.rev_map convert_to_wasm) opt_params in |
There was a problem hiding this comment.
Is this a bug in the official wasm interpreter?
There was a problem hiding this comment.
Internally, the interpreter represents the value stack as a list in reverse order, so that popping from the stack is equivalent to taking the head of the list.
My tweaked version of the interpreter exposes an entrypoint function that assumes this reversal has already happened, hence the confusion. When I cut a new version of my interpreter, I can investigate if it makes sense to push the reversal down further, but an advantage of doing it this way is that the rev and map operations can be carried out here simultaneously, which is more efficient.
wasm-spec-interpreterwasm-spec-interpreter
Subscribe to Label Actioncc @fitzgen DetailsThis issue or pull request has been labeled: "fuzzing"Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
In #4671, the meta-differential fuzz target was finding errors when
running certain Wasm modules (specifically
shr_sin that case).@conrad-watt diagnosed the issue as a missing reversal in the operands
passed to the spec interpreter. This change fixes #4671 and adds an
additional unit test to keep it fixed.