diff --git a/crates/wasmparser/src/validator.rs b/crates/wasmparser/src/validator.rs index d8fbe2b317..2abe3bf347 100644 --- a/crates/wasmparser/src/validator.rs +++ b/crates/wasmparser/src/validator.rs @@ -610,6 +610,11 @@ impl<'a> ValidatingParser<'a> { Some(state) => state, None => return Ok(self.cur_module().section_order_state), }; + if state == SectionOrderState::ModuleLinkingHeader + && !self.config.operator_config.enable_module_linking + { + return self.create_error("module linking proposal not enabled"); + } Ok(match self.cur_module().section_order_state { // Did we just start? In that case move to our newly-found state. Initial => state, diff --git a/tests/local/missing-features/linking-not-enabled.wast b/tests/local/missing-features/linking-not-enabled.wast new file mode 100644 index 0000000000..9de4cc48a4 --- /dev/null +++ b/tests/local/missing-features/linking-not-enabled.wast @@ -0,0 +1,7 @@ +(assert_invalid + (module binary + "\00asm" + "\01\00\00\00" + "\64\01\00" + ) + "module linking proposal not enabled") diff --git a/tests/roundtrip.rs b/tests/roundtrip.rs index 5a3ed63a0d..7707f67b32 100644 --- a/tests/roundtrip.rs +++ b/tests/roundtrip.rs @@ -665,7 +665,7 @@ impl TestState { }; for part in test.iter().filter_map(|t| t.to_str()) { match part { - "testsuite" | "wasmtime905.wast" => { + "testsuite" | "wasmtime905.wast" | "missing-features" => { config.operator_config.enable_threads = false; config.operator_config.enable_reference_types = false; config.operator_config.enable_simd = false;