Browse Source

Allow at least 1 page of memory when disallowing traps (#5421)

This commit fixes configuration of the pooling instance allocator when
traps are disallowed while fuzzing to ensure that there's at least one
page of memory. The support in `wasm-smith` currently forcibly creates a
1-page memory which was previously invalid in the pooling instance
allocator under the generated configuration, so this commit updates the
configuration generated to ensure that it can fit the generated module.
pull/5423/head
Alex Crichton 2 years ago
committed by GitHub
parent
commit
37ade17e2a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      crates/fuzzing/src/generators/config.rs

14
crates/fuzzing/src/generators/config.rs

@ -311,6 +311,20 @@ impl<'a> Arbitrary<'a> for Config {
cfg.max_memory_pages = pooling.instance_memory_pages;
}
// If traps are disallowed then memories must have at least one page
// of memory so if we still are only allowing 0 pages of memory then
// increase that to one here.
if cfg.disallow_traps {
if pooling.instance_memory_pages == 0 {
pooling.instance_memory_pages = 1;
cfg.max_memory_pages = 1;
}
// .. additionally update tables
if pooling.instance_table_elements == 0 {
pooling.instance_table_elements = 1;
}
}
// Forcibly don't use the `CustomUnaligned` memory configuration
// with the pooling allocator active.
if let MemoryConfig::CustomUnaligned = config.wasmtime.memory_config {

Loading…
Cancel
Save