Skip to content

Commit 79d3706

Browse files
committed
properly use explicit dangling Sp instead of null
1 parent fa6eda4 commit 79d3706

File tree

1 file changed

+4
-4
lines changed
  • crates/wasmi/src/engine/executor/handler

1 file changed

+4
-4
lines changed

crates/wasmi/src/engine/executor/handler/state.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,9 @@ impl Sp {
180180
}
181181
}
182182

183-
pub fn null() -> Self {
183+
pub fn dangling() -> Self {
184184
Self {
185-
value: ptr::null_mut(),
185+
value: ptr::dangling_mut(),
186186
}
187187
}
188188

@@ -355,7 +355,7 @@ impl ValueStack {
355355
fn push(&mut self, start: usize, len_slots: usize, len_params: u16) -> Result<Sp, TrapCode> {
356356
debug_assert!(usize::from(len_params) <= len_slots);
357357
if len_slots == 0 {
358-
return Ok(Sp::null());
358+
return Ok(Sp::dangling());
359359
}
360360
let Some(end) = start.checked_add(len_slots) else {
361361
return Err(TrapCode::StackOverflow);
@@ -382,7 +382,7 @@ impl ValueStack {
382382
debug_assert!(params_offset <= len_slots);
383383
debug_assert!(params_offset + usize::from(params_len) <= len_slots);
384384
if len_slots == 0 {
385-
return Ok(Sp::null());
385+
return Ok(Sp::dangling());
386386
}
387387
let Some(end) = start.checked_add(len_slots) else {
388388
return Err(TrapCode::StackOverflow);

0 commit comments

Comments
 (0)