From 212f7c3374357af9eea3983b5e2cf649ccef7d0f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Thu, 22 Feb 2024 10:56:10 -0800 Subject: Fuzzer: Allow using initial content with V8 (#6327) One problem was that spec testcases had exports with names that are not valid to write as JS exports.name. For example an export with a - in the name would end up as exports.foo-bar etc. Since #6310 that is fixed as we do not emit such JS (we use the generic fuzz_shell.js script which iterates over the keys in exports with exports[name]). Also fix a few trivial fuzzer issues that initial content uncovered: - Ignore a wat file with invalid utf-8. - Print string literals in the same way from JS as from C++. - Enable the stringref flag in V8. - Remove tag imports (the same as we do for global and function and other imports). --- src/tools/fuzzing/fuzzing.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index 2b776144d..c1625d726 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -433,6 +433,15 @@ void TranslateToFuzzReader::setupGlobals() { } void TranslateToFuzzReader::setupTags() { + // As in modifyInitialFunctions(), we can't allow tag imports as it would trap + // when the fuzzing infrastructure doesn't know what to provide. + for (auto& tag : wasm.tags) { + if (tag->imported()) { + tag->module = tag->base = Name(); + } + } + + // Add some random tags. Index num = upTo(3); for (size_t i = 0; i < num; i++) { addTag(); -- cgit v1.2.3