Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Limit the size of constants in wasm-smith (#13763)

Alex Crichtonc507c856ee66
diff --git a/crates/fuzzing/src/generators/module.rs b/crates/fuzzing/src/generators/module.rs
index 6b31472232..3ebbcbddd1 100644
--- a/crates/fuzzing/src/generators/module.rs
+++ b/crates/fuzzing/src/generators/module.rs
@@ -119,7 +119,12 @@ impl ModuleConfig {
None
};
- let mut module = wasm_smith::Module::new(self.config.clone(), input)?;
+ let mut config = self.config.clone();
+ if default_fuel.is_some() {
+ config.limit_arrays_in_const_exprs = true;
+ }
+
+ let mut module = wasm_smith::Module::new(config, input)?;
if let Some(before) = input_before {
static GEN_CNT: AtomicUsize = AtomicUsize::new(0);
@@ -129,7 +134,7 @@ impl ModuleConfig {
let config = format!("testcase{i}.json");
log::debug!("writing `{dna}` and `{config}`");
std::fs::write(&dna, &before[..used]).unwrap();
- std::fs::write(&config, serde_json::to_string_pretty(&self.config).unwrap()).unwrap();
+ std::fs::write(&config, serde_json::to_string_pretty(&config).unwrap()).unwrap();
}
if let Some(default_fuel) = default_fuel {