diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index f2a8397e6e4..287e1d50e26 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp @@ -993,6 +993,14 @@ void TranslateToFuzzReader::finalizeTable() { table->init = makeConst(table->type); } } + + if (table->init && (!FindAll(table->init).list.empty() || + !FindAll(table->init).list.empty())) { + // Similar to in setupGlobals(), if we emit RefAs or ContNew for a table + // initializer, it's not valid. Switch to a safe type. + table->type = Type(HeapType::func, Nullable); + table->init = makeConst(table->type); + } } }