Skip to content

Commit 084452a

Browse files
author
Peter Huene
authored
Fix max memory pages for spectests fuzz target. (#3829)
This commit fixes the spectests fuzz target to set a lower bound on the arbitrary pooling allocator configurations of 10 memory pages so that the limit doesn't interfere with what's required in the spec tests.
1 parent 2ca01ae commit 084452a

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

crates/fuzzing/src/generators.rs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,10 +405,22 @@ impl Config {
405405
config.reference_types_enabled = true;
406406
config.max_memories = 1;
407407

408-
if let InstanceAllocationStrategy::Pooling { module_limits, .. } =
409-
&mut self.wasmtime.strategy
408+
if let InstanceAllocationStrategy::Pooling {
409+
module_limits: limits,
410+
..
411+
} = &mut self.wasmtime.strategy
410412
{
411-
module_limits.memories = 1;
413+
limits.memories = 1;
414+
// Set a lower bound of 10 pages as the spec tests define memories with at
415+
// least a few pages and some tests do memory grow operations.
416+
limits.memory_pages = std::cmp::max(limits.memory_pages, 10);
417+
418+
match &mut self.wasmtime.memory_config {
419+
MemoryConfig::Normal(config) => {
420+
config.static_memory_maximum_size = Some(limits.memory_pages * 0x10000);
421+
}
422+
MemoryConfig::CustomUnaligned => unreachable!(), // Arbitrary impl for `Config` should have prevented this
423+
}
412424
}
413425
}
414426

0 commit comments

Comments
 (0)