Improve stability for fuzz targets. (#3804)
This commit improves the stability of the fuzz targets by ensuring the generated configs and modules are congruent, especially when the pooling allocator is being used. For the `differential` target, this means both configurations must use the same allocation strategy for now as one side generates the module that might not be compatible with another arbitrary config now that we fuzz the pooling allocator. These changes also ensure that constraints put on the config are more consistently applied, especially when using a fuel-based timeout.
This commit is contained in:
@@ -13,9 +13,8 @@ fuzz_target!(|data: &[u8]| {
|
||||
fn run(data: &[u8]) -> Result<()> {
|
||||
let mut u = Unstructured::new(data);
|
||||
let mut config: generators::Config = u.arbitrary()?;
|
||||
config.module_config.set_differential_config();
|
||||
let mut module = config.module_config.generate(&mut u)?;
|
||||
module.ensure_termination(1000);
|
||||
config.set_differential_config();
|
||||
let module = config.generate(&mut u, Some(1000))?;
|
||||
oracles::differential_wasmi_execution(&module.to_bytes(), &config);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user