Skip to content

Commit

Permalink
Fix possible access to fromspace in MVM_frame_find_lexical_by_name_outer
Browse files Browse the repository at this point in the history
MVM_frame_find_lexical_by_name_rel may trigger GC thus outdating the name
pointer used by the error handling path.
  • Loading branch information
niner committed Apr 24, 2020
1 parent 651dc59 commit 8a7e56d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/core/frame.c
Expand Up @@ -1394,7 +1394,10 @@ MVM_PUBLIC void MVM_frame_bind_lexical_by_name(MVMThreadContext *tc, MVMString *

/* Finds a lexical in the outer frame, throwing if it's not there. */
MVMObject * MVM_frame_find_lexical_by_name_outer(MVMThreadContext *tc, MVMString *name) {
MVMRegister *r = MVM_frame_find_lexical_by_name_rel(tc, name, tc->cur_frame->outer);
MVMRegister *r;
MVMROOT(tc, name, {
r = MVM_frame_find_lexical_by_name_rel(tc, name, tc->cur_frame->outer);
});
if (MVM_LIKELY(r != NULL))
return r->o;
else {
Expand Down

0 comments on commit 8a7e56d

Please sign in to comment.