-
When using the wasm-opt to generate random Wasm binary: wasm-opt -ttf [random_file] -o generated_wasm.wasm I checked the source code and found the main build function is |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
The wasm file is a valid wasm file, in the sense that it validates in Binaryen, and should validate in all wasm VMs, unless we have a bug (please report it, if so). Wasm itself does not have undefined behavior. The closest is nondeterminism in NaNs. The fuzzer does have some logic to handle that, it can do a "de-NaN" operation (search for NAN in (Other issues exist like infinite loops which are not undefined behavior, but can be a problem when fuzzing. The fuzzer also has logic to prevent that, see |
Beta Was this translation helpful? Give feedback.
-
As @kripken described, there is no UB in Wasm, but there are traps. For example, dividing an integer by 0 or accessing out-of-bounds memory will trap. This is not UB because it is well-defined behavior in the Wasm spec, but it is still something that normal programs would avoid. Programs generated by the fuzzer can trap, although we try to generate code patterns that will avoid trapping where possible. |
Beta Was this translation helpful? Give feedback.
The wasm file is a valid wasm file, in the sense that it validates in Binaryen, and should validate in all wasm VMs, unless we have a bug (please report it, if so).
Wasm itself does not have undefined behavior. The closest is nondeterminism in NaNs. The fuzzer does have some logic to handle that, it can do a "de-NaN" operation (search for NAN in
scripts/fuzz_opt.py
) to avoid NaNs at runtime, making the output fully deterministic.(Other issues exist like infinite loops which are not undefined behavior, but can be a problem when fuzzing. The fuzzer also has logic to prevent that, see
addHangLimitChecks()
.)