mirror of
https://github.com/urbit/ares.git
synced 2024-11-26 20:58:02 +03:00
mem: assert stack_is_empty() when it should be
if these functions are callled with a non-empty lightweight stack, they will try to pop things that they shouldn't. all other stack_is_empty() callsites happen in a fresh stack frame, so we already know the lightweight stack will be empty.
This commit is contained in:
parent
21a13ee444
commit
028519edd7
@ -351,6 +351,7 @@ impl NockStack {
|
||||
|
||||
unsafe fn copy(&mut self, noun: &mut Noun) {
|
||||
self.pre_copy();
|
||||
assert!(self.stack_is_empty());
|
||||
let noun_ptr = noun as *mut Noun;
|
||||
// Add two slots to the lightweight stack
|
||||
// Set the first new slot to the noun to be copied
|
||||
@ -447,6 +448,7 @@ impl NockStack {
|
||||
&& (*(self.prev_stack_pointer_pointer())).is_null()
|
||||
&& (*(self.prev_frame_pointer_pointer())).is_null()
|
||||
);
|
||||
assert!(self.stack_is_empty());
|
||||
let noun_ptr = noun as *mut Noun;
|
||||
*(self.push::<Noun>()) = *noun;
|
||||
*(self.push::<*mut Noun>()) = noun_ptr;
|
||||
|
Loading…
Reference in New Issue
Block a user