Test denial of floating-point parameters

This commit is contained in:
Vurich 2018-04-17 10:41:15 +02:00
parent cfc7f1b693
commit bd7a13138f
1 changed files with 13 additions and 0 deletions

View File

@ -472,6 +472,19 @@ impl Module {
///
/// let module = wasmi::Module::from_buffer(&wasm_binary).expect("Parsing failed");
/// assert!(module.deny_floating_point().is_err());
///
/// let wasm_binary: Vec<u8> =
/// wabt::wat2wasm(
/// r#"
/// (module
/// (func $add (param $lhs f32) (param $rhs f32) (result f32)
/// get_local $lhs))
/// "#,
/// )
/// .expect("failed to parse wat");
///
/// let module = wasmi::Module::from_buffer(&wasm_binary).expect("Parsing failed");
/// assert!(module.deny_floating_point().is_err());
/// ```
pub fn deny_floating_point(&self) -> Result<(), Error> {
validation::deny_floating_point(&self.module).map_err(Into::into)