Skip to content

Commit

Permalink
Set frame->static_info in allocate_frame
Browse files Browse the repository at this point in the history
So it's there right from the start. If the spesh log entry fills up
the log and causes it to be sent, then we might have a frame with no
static_info on the temp roots stack. This can cause a NULL pointer
dereference inside the GC. We could NULL-guard it there, but it's
less work to just make sure that situation can never happen.
  • Loading branch information
jnthn committed Oct 5, 2017
1 parent 716f6fc commit 953c384
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/core/frame.c
Expand Up @@ -303,6 +303,9 @@ static MVMFrame * allocate_frame(MVMThreadContext *tc, MVMStaticFrame *static_fr
frame->allocd_work = 0;
}

/* Set static frame. */
frame->static_info = static_frame;

/* Assign a sequence nr */
frame->sequence_nr = tc->next_frame_nr++;

Expand Down Expand Up @@ -538,9 +541,6 @@ void MVM_frame_invoke(MVMThreadContext *tc, MVMStaticFrame *static_frame,
}
}

/* Set static frame. */
frame->static_info = static_frame;

/* Store the code ref (NULL at the top-level). */
frame->code_ref = code_ref;

Expand Down

0 comments on commit 953c384

Please sign in to comment.