From 6cf47248ce9d57e819592e3c07c061371ebd1c84 Mon Sep 17 00:00:00 2001 From: Greg Date: Wed, 26 Jul 2023 01:06:07 +0900 Subject: [PATCH] Ignore async_stack_size if async_support is disabled Fixes an issue where max_wasm_stack was being validated against async_stack_size when async_support was disabled, discussed in #6762. --- crates/wasmtime/src/config.rs | 2 +- tests/all/traps.rs | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rs index b0d5bdc87fa7..42e88137535d 100644 --- a/crates/wasmtime/src/config.rs +++ b/crates/wasmtime/src/config.rs @@ -1498,7 +1498,7 @@ impl Config { bail!("feature 'threads' requires 'bulk_memory' to be enabled"); } #[cfg(feature = "async")] - if self.max_wasm_stack > self.async_stack_size { + if self.async_support && self.max_wasm_stack > self.async_stack_size { bail!("max_wasm_stack size cannot exceed the async_stack_size"); } if self.max_wasm_stack == 0 { diff --git a/tests/all/traps.rs b/tests/all/traps.rs index 183ce2d408f9..5b7377fa1537 100644 --- a/tests/all/traps.rs +++ b/tests/all/traps.rs @@ -1643,3 +1643,13 @@ fn same_module_multiple_stores() -> Result<()> { Ok(()) } + +#[test] +fn async_stack_size_ignored_if_disabled() -> Result<()> { + let mut config = Config::new(); + config.async_support(false); + config.max_wasm_stack(8 << 20); + Engine::new(&config)?; + + Ok(()) +}