Skip to content
This repository was archived by the owner on Dec 17, 2022. It is now read-only.

Commit 633469d

Browse files
committed
fix(bvm): always use offset of at least 1 for nested call frames
1 parent bc36e09 commit 633469d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

brane-bvm/src/vm.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
use std::cmp::max;
2+
13
use crate::frames::CallFrame;
24
use crate::objects::Class;
35
use crate::stack::{Slot, Stack};
@@ -277,7 +279,8 @@ where
277279
.await
278280
.unwrap();
279281

280-
let frame = CallFrame::new(function, frame_first);
282+
// Position 0 is the main function, never allow it as root for a nested call frame.
283+
let frame = CallFrame::new(function, max(frame_first, 1));
281284
self.frames.push(frame);
282285

283286
return;

0 commit comments

Comments
 (0)