Permalink
Browse files

Fixed uninitialized local variable bug; ref #3692

  • Loading branch information...
matz committed Jun 13, 2017
1 parent b32ad13 commit 7830b841c74f83c15c4b67ca89f1e908b68e5b7d
Showing with 9 additions and 11 deletions.
  1. +9 −11 src/vm.c
View
@@ -1241,7 +1241,7 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
int n = GETARG_C(i);
struct RProc *m;
struct RClass *c;
mrb_callinfo *ci;
mrb_callinfo *ci = mrb->c->ci;
mrb_value recv, result;
mrb_sym mid = syms[GETARG_B(i)];
int bidx;
@@ -1255,19 +1255,19 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
bidx = a+n+1;
}
if (GET_OPCODE(i) != OP_SENDB) {
if (bidx >= mrb->c->ci->nregs) {
if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1);
mrb->c->ci->nregs = bidx+1;
ci->nregs = bidx+1;
}
SET_NIL_VALUE(regs[bidx]);
SET_NIL_VALUE(blk);
blk = mrb_nil_value();
}
else {
mrb_value blk = regs[bidx];
blk = regs[bidx];
if (!mrb_nil_p(blk) && mrb_type(blk) != MRB_TT_PROC) {
if (bidx >= mrb->c->ci->nregs) {
if (bidx >= ci->nregs) {
stack_extend(mrb, bidx+1);
mrb->c->ci->nregs = bidx+1;
ci->nregs = bidx+1;
}
result = mrb_convert_type(mrb, blk, MRB_TT_PROC, "Proc", "to_proc");
blk = regs[bidx] = result;
@@ -1294,10 +1294,8 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
}
mid = missing;
if (n != CALL_MAXARGS) {
mrb_value blk = regs[bidx];
if (a+2 > irep->nregs) {
stack_extend(mrb, a+2);
if (a+2 >= irep->nregs) {
stack_extend(mrb, a+3);
}
regs[a+1] = mrb_ary_new_from_values(mrb, n, regs+a+1);
regs[a+2] = blk;

0 comments on commit 7830b84

Please sign in to comment.