Don't generate ref.as_non_null for table initializers
diff --git a/src/tools/fuzzing/fuzzing.cpp b/src/tools/fuzzing/fuzzing.cpp index f2a8397..287e1d5 100644 --- a/src/tools/fuzzing/fuzzing.cpp +++ b/src/tools/fuzzing/fuzzing.cpp
@@ -993,6 +993,14 @@ table->init = makeConst(table->type); } } + + if (table->init && (!FindAll<RefAs>(table->init).list.empty() || + !FindAll<ContNew>(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); + } } }