Skip to content

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

Use traps when checking initial table/memory bounds (#12929)

Alex Crichton517c02878767
diff --git a/crates/wasmtime/src/runtime/vm/instance/allocator.rs b/crates/wasmtime/src/runtime/vm/instance/allocator.rs
index 5475a02451..9b70b73e8b 100644
--- a/crates/wasmtime/src/runtime/vm/instance/allocator.rs
+++ b/crates/wasmtime/src/runtime/vm/instance/allocator.rs
@@ -517,7 +517,7 @@ fn check_table_init_bounds(
// Initializer is in bounds
}
_ => {
- bail!("table out of bounds: elements segment does not fit")
+ bail!(Trap::TableOutOfBounds);
}
}
}
@@ -627,7 +627,7 @@ fn check_memory_init_bounds(
// Initializer is in bounds
}
_ => {
- bail!("memory out of bounds: data segment does not fit")
+ bail!(Trap::MemoryOutOfBounds);
}
}
}