Skip to content

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

Add an OOM test for `Linker::new` (#12419)

Nick Fitzgerald17bff9dcf644
diff --git a/crates/fuzzing/tests/oom.rs b/crates/fuzzing/tests/oom.rs
index e7d370bc6d..b002f395cf 100644
--- a/crates/fuzzing/tests/oom.rs
+++ b/crates/fuzzing/tests/oom.rs
@@ -126,6 +126,18 @@ fn engine_new() -> Result<()> {
})
}
+#[test]
+#[cfg(arc_try_new)]
+fn linker_new() -> Result<()> {
+ OomTest::new().test(|| {
+ let mut config = Config::new();
+ config.enable_compiler(false);
+ let engine = Engine::new(&config)?;
+ let _linker = Linker::<()>::new(&engine);
+ Ok(())
+ })
+}
+
fn ok_if_not_oom(error: Error) -> Result<()> {
if error.is::<OutOfMemory>() {
Err(error)