mirror of
https://github.com/mii443/wasmer.git
synced 2025-12-07 05:08:19 +00:00
Removed uint8view() from the memory API and redundant FunctionEnv in tests
This commit is contained in:
4
lib/api/src/sys/externals/memory.rs
vendored
4
lib/api/src/sys/externals/memory.rs
vendored
@@ -8,6 +8,7 @@ use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
use std::mem::MaybeUninit;
|
||||
use std::slice;
|
||||
#[cfg(feature = "tracing")]
|
||||
use tracing::warn;
|
||||
use wasmer_types::Pages;
|
||||
use wasmer_vm::{InternalStoreHandle, MemoryError, StoreHandle, StoreObjects, VMExtern, VMMemory};
|
||||
@@ -177,6 +178,7 @@ impl<'a> MemoryBuffer<'a> {
|
||||
.checked_add(buf.len() as u64)
|
||||
.ok_or(MemoryAccessError::Overflow)?;
|
||||
if end > self.len.try_into().unwrap() {
|
||||
#[cfg(feature = "tracing")]
|
||||
warn!("attempted to read ({} bytes) beyond the bounds of the memory view ({} > {})", buf.len(), end, self.len);
|
||||
return Err(MemoryAccessError::HeapOutOfBounds);
|
||||
}
|
||||
@@ -195,6 +197,7 @@ impl<'a> MemoryBuffer<'a> {
|
||||
.checked_add(buf.len() as u64)
|
||||
.ok_or(MemoryAccessError::Overflow)?;
|
||||
if end > self.len.try_into().unwrap() {
|
||||
#[cfg(feature = "tracing")]
|
||||
warn!("attempted to read ({} bytes) beyond the bounds of the memory view ({} > {})", buf.len(), end, self.len);
|
||||
return Err(MemoryAccessError::HeapOutOfBounds);
|
||||
}
|
||||
@@ -211,6 +214,7 @@ impl<'a> MemoryBuffer<'a> {
|
||||
.checked_add(data.len() as u64)
|
||||
.ok_or(MemoryAccessError::Overflow)?;
|
||||
if end > self.len.try_into().unwrap() {
|
||||
#[cfg(feature = "tracing")]
|
||||
warn!("attempted to write ({} bytes) beyond the bounds of the memory view ({} > {})", data.len(), end, self.len);
|
||||
return Err(MemoryAccessError::HeapOutOfBounds);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user