1 parent 570cf7d commit ff21631Copy full SHA for ff21631
1 file changed
src/hyperlight_host/src/mem/shared_mem.rs
@@ -1399,10 +1399,12 @@ impl HostSharedMemory {
1399
self.write::<u64>(stack_pointer_abs + data.len(), stack_pointer_rel as u64)?;
1400
1401
// update stack pointer to point to the next free address
1402
- let new_sp = stack_pointer_rel
+ let new_sp: u64 = stack_pointer_rel
1403
.checked_add(data.len())
1404
.and_then(|v| v.checked_add(8))
1405
- .ok_or(StackError::PushSizeOverflow(data.len()))? as u64;
+ .ok_or(StackError::PushSizeOverflow(data.len()))?
1406
+ .try_into()
1407
+ .map_err(|_| StackError::PushSizeOverflow(data.len()))?;
1408
self.write::<u64>(buffer_start_offset, new_sp)?;
1409
Ok(())
1410
}
0 commit comments