Skip to content

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

Fix a missing `Try*` collection in `Module` (#13493)

Alex Crichton846f97033c59
diff --git a/crates/environ/src/compile/module_environ.rs b/crates/environ/src/compile/module_environ.rs
index d06ece9d94..be2fc09c0d 100644
--- a/crates/environ/src/compile/module_environ.rs
+++ b/crates/environ/src/compile/module_environ.rs
@@ -696,7 +696,7 @@ impl<'a, 'data> ModuleEnvironment<'a, 'data> {
DataKind::Passive => {
let range = mk_range(&mut self.result.total_passive_data)?;
self.result.passive_data.push(data);
- Some(self.result.module.passive_data.push(range))
+ Some(self.result.module.passive_data.push(range)?)
}
};
self.result
diff --git a/crates/environ/src/module.rs b/crates/environ/src/module.rs
index 29dc0d298e..1983b9729b 100644
--- a/crates/environ/src/module.rs
+++ b/crates/environ/src/module.rs
@@ -326,7 +326,7 @@ pub struct Module {
pub passive_elements: TryPrimaryMap<PassiveElemIndex, TableSegmentElements>,
/// Where passive data segments are located in the module's image.
- pub passive_data: PrimaryMap<PassiveDataIndex, Range<u32>>,
+ pub passive_data: TryPrimaryMap<PassiveDataIndex, Range<u32>>,
/// Types declared in the wasm module.
pub types: TryPrimaryMap<TypeIndex, EngineOrModuleTypeIndex>,
diff --git a/crates/fuzzing/tests/oom/module.rs b/crates/fuzzing/tests/oom/module.rs
index 20c634a053..322ea17d4f 100644
--- a/crates/fuzzing/tests/oom/module.rs
+++ b/crates/fuzzing/tests/oom/module.rs
@@ -17,9 +17,11 @@ fn module_deserialize() -> Result<()> {
(memory (export "memory") 1)
(data (i32.const 0) "a")
+ (data "a")
(table (export "table") 1 funcref)
(elem (i32.const 0) func 1)
+ (elem func 1)
(func (export "func") (param i32) (result i32)
(call 0 (local.get 0))