Skip to content

Commit bf58ec8

Browse files
authored
fuzz(no_traps): enable the custom-page-sizes proposal as necessary (#1620)
* fuzz(no_traps): enable the custom-page-sizes proposal as necessary If the `wasm-smith` config enabled it, then we should enable it for validation. * Enable all validator features * fix unused var
1 parent 1d40214 commit bf58ec8

1 file changed

Lines changed: 3 additions & 16 deletions

File tree

fuzz/src/no_traps.rs

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn run(u: &mut Unstructured<'_>) -> Result<()> {
2424
config.memory64_enabled = false;
2525
Ok(())
2626
})?;
27-
validate_module(config.clone(), &wasm_bytes);
27+
validate_module(&wasm_bytes);
2828

2929
// Tail calls aren't implemented in wasmtime, so don't try to run them
3030
// there.
@@ -111,22 +111,9 @@ pub fn run(u: &mut Unstructured<'_>) -> Result<()> {
111111
Ok(())
112112
}
113113

114-
fn validate_module(config: wasm_smith::Config, wasm_bytes: &Vec<u8>) {
114+
fn validate_module(wasm_bytes: &Vec<u8>) {
115115
// Validate the module or component and assert that it passes validation.
116-
let mut validator = wasmparser::Validator::new_with_features({
117-
let mut features = WasmFeatures::default();
118-
features.remove(WasmFeatures::COMPONENT_MODEL);
119-
features.set(WasmFeatures::MULTI_VALUE, config.multi_value_enabled);
120-
features.set(WasmFeatures::MULTI_MEMORY, config.max_memories > 1);
121-
features.insert(WasmFeatures::BULK_MEMORY);
122-
features.insert(WasmFeatures::REFERENCE_TYPES);
123-
features.set(WasmFeatures::SIMD, config.simd_enabled);
124-
features.set(WasmFeatures::RELAXED_SIMD, config.relaxed_simd_enabled);
125-
features.set(WasmFeatures::MEMORY64, config.memory64_enabled);
126-
features.set(WasmFeatures::THREADS, config.threads_enabled);
127-
features.set(WasmFeatures::EXCEPTIONS, config.exceptions_enabled);
128-
features
129-
});
116+
let mut validator = wasmparser::Validator::new_with_features(WasmFeatures::all());
130117
if let Err(e) = validator.validate_all(wasm_bytes) {
131118
panic!("Invalid module: {}", e);
132119
}

0 commit comments

Comments
 (0)