Skip to content

Commit

Permalink
Add "no super" check to OP_ARGARY; fix #3610
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 18, 2017
1 parent c396184 commit 82ab461
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/vm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,16 +1514,17 @@ mrb_vm_exec(mrb_state *mrb, struct RProc *proc, mrb_code *pc)
int lv = (bx>>0)&0xf;
mrb_value *stack;

if (mrb->c->ci->mid == 0 || mrb->c->ci->target_class == NULL) {
mrb_value exc;

L_NOSUPER:
exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, "super called outside of method");
mrb_exc_set(mrb, exc);
}
if (lv == 0) stack = regs + 1;
else {
struct REnv *e = uvenv(mrb, lv-1);
if (!e) {
mrb_value exc;

exc = mrb_exc_new_str_lit(mrb, E_NOMETHOD_ERROR, "super called outside of method");
mrb_exc_set(mrb, exc);
goto L_RAISE;
}
if (!e) goto L_NOSUPER;
stack = e->stack + 1;
}
if (r == 0) {
Expand Down

0 comments on commit 82ab461

Please sign in to comment.