summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2021-04-06 10:08:35 -0700
committerGitHub <noreply@github.com>2021-04-06 10:08:35 -0700
commitcc0439224cfc2eabe8f8c28d782ab6b44a0f24f9 (patch)
treed44f639f2eb835ed7839e82885e8ebba212cfd84 /src
parentb900ed95deda68dad12b3aac7d1283f642e7a545 (diff)
downloadbinaryen-cc0439224cfc2eabe8f8c28d782ab6b44a0f24f9.tar.gz
binaryen-cc0439224cfc2eabe8f8c28d782ab6b44a0f24f9.tar.bz2
binaryen-cc0439224cfc2eabe8f8c28d782ab6b44a0f24f9.zip
Fuzzing in JS VMs: Print types when we have nothing better (#3773)
This matches #3747 which makes us not log out reference values, instead we print just their types. This also prints a type for non-reference things, replacing a previous exception, which affects things like SIMD and BigInts, but those trap anyhow at the JS boundary I believe (or did that change for SIMD?). Anyhow, printing the type won't give a false "ok" when comparing wasm2js output to the interpreter, assuming the interpreter prints out a value and not just a type (which is the case). We could try to do better, but this code is on the JS side, where we don't have the type - just a string representation of it, which we'd need to parse etc.
Diffstat (limited to 'src')
-rw-r--r--src/tools/js-wrapper.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/tools/js-wrapper.h b/src/tools/js-wrapper.h
index 3a1a1aa4a..9568bccc0 100644
--- a/src/tools/js-wrapper.h
+++ b/src/tools/js-wrapper.h
@@ -60,7 +60,8 @@ static std::string generateJSWrapper(Module& wasm) {
" ret += Number(x).toString();\n"
" break;\n"
" }\n"
- " default: throw 'what?';\n"
+ " // For anything else, just print the type.\n"
+ " default: ret += type; break;\n"
" }\n"
" return ret;\n"
"}\n"