From 5e2b9878776c71ff2fccd64f8eda13392012ff69 Mon Sep 17 00:00:00 2001 From: stevenfontanella Date: Wed, 22 Jul 2026 18:00:30 +0000 Subject: [PATCH] Don't generate ref.as_non_null for table initializers --- src/tools/fuzzing/fuzzing.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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); + } } }