mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 13:59:08 +00:00
wasm_interp: create a new error MemoryAccessOutOfBounds
This commit is contained in:
parent
17d8ef2aa7
commit
a3b5a9d9a2
2 changed files with 21 additions and 3 deletions
|
@ -67,6 +67,7 @@ impl<'a> ImportDispatcher for DefaultImportDispatcher<'a> {
|
|||
pub(crate) enum Error {
|
||||
Type(ValueType, ValueType),
|
||||
StackEmpty,
|
||||
MemoryAccessOutOfBounds(u32, u32),
|
||||
UnreachableOp,
|
||||
}
|
||||
|
||||
|
@ -85,6 +86,12 @@ impl Error {
|
|||
file_offset
|
||||
)
|
||||
}
|
||||
Error::MemoryAccessOutOfBounds(addr, memory_size) => {
|
||||
format!(
|
||||
"ERROR: A Wasm instruction at file offset {:#x} tried to access memory at {:#x} but the maximum address is {:#x}\n",
|
||||
file_offset, addr, memory_size-1
|
||||
)
|
||||
}
|
||||
Error::UnreachableOp => {
|
||||
format!(
|
||||
"WebAssembly `unreachable` instruction at file offset {:#x}.\n",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue