Asserted bidx < ci->nregs for OP_SEND and OP_SUPER

This commit is contained in:
Christopher Aue
2017-08-22 11:24:46 +02:00
parent 4c9a604877
commit 64e5208404
+5 -1
View File
@@ -1333,10 +1333,12 @@ RETRY_TRY_BLOCK:
int bidx = (argc < 0) ? a+2 : a+n+1;
struct RProc *m;
struct RClass *c;
mrb_callinfo *ci;
mrb_callinfo *ci = mrb->c->ci;
mrb_value recv, blk;
mrb_sym mid = syms[GETARG_B(i)];
mrb_assert(bidx < ci->nregs);
recv = regs[a];
if (GET_OPCODE(i) != OP_SENDB) {
SET_NIL_VALUE(regs[bidx]);
@@ -1523,6 +1525,8 @@ RETRY_TRY_BLOCK:
mrb_value recv, blk;
mrb_sym mid = ci->mid;
mrb_assert(bidx < ci->nregs);
if (mid == 0 || !ci->target_class) {
mrb_value exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, "super called outside of method");
mrb_exc_set(mrb, exc);