Remove sandboxing host function interface (#12852)

* Remove sandboxing interface

* Remove unused struct
This commit is contained in:
Alexander Theißen
2022-12-07 13:48:30 +01:00
committed by GitHub
parent 198faaa6f9
commit 32578cb010
31 changed files with 34 additions and 4478 deletions
@@ -48,24 +48,6 @@ pub fn into_wasmtime_val(value: Value) -> wasmtime::Val {
}
}
/// Read data from a slice of memory into a newly allocated buffer.
///
/// Returns an error if the read would go out of the memory bounds.
pub(crate) fn read_memory(
ctx: impl AsContext<Data = StoreData>,
source_addr: Pointer<u8>,
size: usize,
) -> Result<Vec<u8>> {
let range =
checked_range(source_addr.into(), size, ctx.as_context().data().memory().data_size(&ctx))
.ok_or_else(|| Error::Other("memory read is out of bounds".into()))?;
let mut buffer = vec![0; range.len()];
read_memory_into(ctx, source_addr, &mut buffer)?;
Ok(buffer)
}
/// Read data from the instance memory into a slice.
///
/// Returns an error if the read would go out of the memory bounds.