aboutsummaryrefslogtreecommitdiffstats
path: root/bytecode/src/heap.rs
diff options
context:
space:
mode:
Diffstat (limited to 'bytecode/src/heap.rs')
-rw-r--r--bytecode/src/heap.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/bytecode/src/heap.rs b/bytecode/src/heap.rs
index c61a30a..78a406f 100644
--- a/bytecode/src/heap.rs
+++ b/bytecode/src/heap.rs
@@ -171,13 +171,14 @@ impl Heap {
}
pub fn peek(&self, p: Pointer, offset: usize) -> Result<Value, String> {
+ let offset_bytes = offset * 8;
let obj_sz = self.alloc_size(p)?;
- if offset >= obj_sz {
+ if offset_bytes >= obj_sz {
return Err(format!(
- "invalid offset {offset} in an object of size {obj_sz}"
+ "invalid offset {offset_bytes} in an object of size {obj_sz}"
));
}
- let (u, _) = open_ptr(p.offset(offset));
+ let (u, _) = open_ptr(p.offset(offset_bytes));
if u >= self.heap.len() {
return Err(format!("invalid pointer {:x}", p));
}