From ee0858eb4aae865de78b908b9fdedf8b2d11920d Mon Sep 17 00:00:00 2001 From: Yi LIU Date: Wed, 25 Feb 2026 21:55:37 +0800 Subject: [PATCH 1/2] [Types] Fix missing inverse check for described field in isValidSupertype The descriptor field check in isValidSupertype was fully symmetric: if the subtype has no descriptor, then the supertype must also have no descriptor. However, the described field check was missing its else branch, allowing a non-descriptor type to illegally subtype a descriptor type when features are fully enabled. Add the missing else branch so that if the subtype has no describes clause, the supertype must also have no describes clause. --- src/wasm/wasm-type.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/wasm/wasm-type.cpp b/src/wasm/wasm-type.cpp index 3b0262ed2ee..129d4eef457 100644 --- a/src/wasm/wasm-type.cpp +++ b/src/wasm/wasm-type.cpp @@ -2419,6 +2419,12 @@ bool isValidSupertype(const HeapTypeInfo& sub, const HeapTypeInfo& super) { if (!super.described || sub.described->supertype != super.described) { return false; } + } else { + // A supertype of a type without a describes clause must also not have a + // describes clause. + if (super.described) { + return false; + } } SubTyper typer; switch (sub.kind) { From a4720ef65dac9420f1f942e965933bc702bd5870 Mon Sep 17 00:00:00 2001 From: Yi LIU Date: Thu, 26 Feb 2026 09:37:27 +0800 Subject: [PATCH 2/2] [wasm-shell] Enable all features before parsing quoted text modules This fixes assert_invalid modules being rejected during parsing rather than during validation when they use features like custom descriptors. --- src/tools/wasm-shell.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/tools/wasm-shell.cpp b/src/tools/wasm-shell.cpp index 2750f9d0b1e..c07108937c0 100644 --- a/src/tools/wasm-shell.cpp +++ b/src/tools/wasm-shell.cpp @@ -102,6 +102,7 @@ struct Shell { std::shared_ptr wasm; if (auto* quoted = std::get_if(&mod.module)) { wasm = std::make_shared(); + wasm->features = FeatureSet::All; switch (quoted->type) { case QuotedModuleType::Text: { CHECK_ERR(parseModule(*wasm, quoted->module));