Skip to content

Commit

Permalink
Check if m->env is NULL before dereferencing it; fix #3436
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Feb 8, 2017
1 parent b277c58 commit 76135e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1309,7 +1309,9 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
else {
stack_extend(mrb, irep->nregs, ci->argc+2);
}
regs[0] = m->env->stack[0];
if(m->env) {
regs[0] = m->env->stack[0];
}
pc = irep->iseq;
JUMP;
}
Expand Down

0 comments on commit 76135e7

Please sign in to comment.