Skip to content

Commit

Permalink
Ignore async_stack_size if async_support is disabled (#6771)
Browse files Browse the repository at this point in the history
Fixes an issue where max_wasm_stack was being validated against
async_stack_size when async_support was disabled, discussed in #6762.
  • Loading branch information
guregu authored Jul 25, 2023
1 parent 729e264 commit 7dfae4c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/wasmtime/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions tests/all/traps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}

0 comments on commit 7dfae4c

Please sign in to comment.