diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-18 10:23:30 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-04-18 10:28:49 +0900 |
| commit | 82ab46139e6ee6bf664a5772cd83c37ed3bc17fe (patch) | |
| tree | 0d35265b600bc2110bfe6eb0d2eeefa45d5819d0 | |
| parent | c3961847cfb9b5370814bd433b0f5c42c034801f (diff) | |
| download | mruby-82ab46139e6ee6bf664a5772cd83c37ed3bc17fe.tar.gz mruby-82ab46139e6ee6bf664a5772cd83c37ed3bc17fe.zip | |
Add "no super" check to OP_ARGARY; fix #3610
| -rw-r--r-- | src/vm.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -1514,16 +1514,17 @@ RETRY_TRY_BLOCK: 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) { |
