Skip to content

Commit 533e511

Browse files
authored
Fix reading end of vector after popping it (#585)
1 parent 06c1ce1 commit 533e511

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/vm.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2082,13 +2082,14 @@ class Interpreter {
20822082
// Cache these, because pop will invalidate them.
20832083
std::vector<HeapThunk *> thunks_copy = f.thunks;
20842084

2085+
const AST *f_ast = f.ast;
20852086
stack.pop();
20862087

20872088
if (func->body == nullptr) {
20882089
// Built-in function.
20892090
// Give nullptr for self because noone looking at this frame will
20902091
// attempt to bind to self (it's native code).
2091-
stack.newFrame(FRAME_BUILTIN_FORCE_THUNKS, f.ast);
2092+
stack.newFrame(FRAME_BUILTIN_FORCE_THUNKS, f_ast);
20922093
stack.top().thunks = thunks_copy;
20932094
stack.top().val = scratch;
20942095
goto replaceframe;

0 commit comments

Comments
 (0)