From f7b3200e9f3dc9e2cbca966cb255c228453c792f Mon Sep 17 00:00:00 2001 From: Robin Freyler Date: Fri, 1 Dec 2023 10:35:28 +0100 Subject: [PATCH] fix bug in wasmi executor --- crates/wasmi/src/engine/mod.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/wasmi/src/engine/mod.rs b/crates/wasmi/src/engine/mod.rs index ec0adecacd..e870f0129d 100644 --- a/crates/wasmi/src/engine/mod.rs +++ b/crates/wasmi/src/engine/mod.rs @@ -647,7 +647,9 @@ impl<'engine> EngineExecutor<'engine> { Results: CallResults, { self.stack.reset(); - self.stack.values.extend(params.call_params()); + let call_params = params.call_params(); + self.stack.values.reserve(call_params.len())?; + self.stack.values.extend(call_params); match ctx.as_context().store.inner.resolve_func(func) { FuncEntity::Wasm(wasm_func) => { self.stack @@ -689,7 +691,9 @@ impl<'engine> EngineExecutor<'engine> { self.stack .values .drop(host_func.ty(ctx.as_context()).params().len()); - self.stack.values.extend(params.call_params()); + let call_params = params.call_params(); + self.stack.values.reserve(call_params.len())?; + self.stack.values.extend(call_params); assert!( self.stack.frames.peek().is_some(), "a frame must be on the call stack upon resumption"