diff --git a/crates/wit-smith/src/lib.rs b/crates/wit-smith/src/lib.rs index 7a29f79e48..29240947d5 100644 --- a/crates/wit-smith/src/lib.rs +++ b/crates/wit-smith/src/lib.rs @@ -46,16 +46,23 @@ pub fn smith(config: &Config, u: &mut Unstructured<'_>) -> Result> { let wasm = wit_component::encode(&resolve, pkg).expect("failed to encode WIT document"); - // Handle disallowing `stream` here vs not generating it to start - // with as it's a bit easier to handle. if let Err(e) = wasmparser::Validator::new_with_features(wasmparser::WasmFeatures::all()) .validate_all(&wasm) { + // Handle disallowing `stream` here vs not generating it to start + // with as it's a bit easier to handle. if e.to_string() .contains("`stream` is not valid at this time") { return Err(arbitrary::Error::IncorrectFormat); } + + // Easier to handle this limit here rather than in generation right now. + if e.to_string() + .contains("value type's maximum in-memory size exceeds maximum byte size") + { + return Err(arbitrary::Error::IncorrectFormat); + } } Ok(wasm) }