diff --git a/lib/wasi/src/ptr.rs b/lib/wasi/src/ptr.rs index 486ba808c..f6d1c4ce4 100644 --- a/lib/wasi/src/ptr.rs +++ b/lib/wasi/src/ptr.rs @@ -55,8 +55,9 @@ impl WasmPtr { unsafe { let cell_ptrs = memory.view::().get_unchecked( - ((self.offset() as usize) / mem::size_of::()) - ..((self.offset() as usize) / mem::size_of::()) + (length as usize), + ((self.offset as usize) / mem::size_of::()) + (index as usize) + ..((self.offset() as usize) / mem::size_of::()) + + ((index + length) as usize), ) as *const _; Some(&*cell_ptrs) }