Permalink
Browse files

Check if m->env is NULL before dereferencing it; fix #3436

  • Loading branch information...
matz committed Feb 8, 2017
1 parent b277c58 commit 76135e757f96ad640e3c44b4d46f73e512fbfc50
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/vm.c
View
@@ -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;
}

0 comments on commit 76135e7

Please sign in to comment.