diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-06 17:20:34 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-12-06 17:28:20 +0900 |
| commit | 6975258efd567c58e483818189216d43b6d77036 (patch) | |
| tree | 7896e4bf15dcdf1fd16333a58ab09ac71b50ffc6 /src/vm.c | |
| parent | ae44e80668657a93dc316b9c7d3524ed311fb3dc (diff) | |
| download | mruby-6975258efd567c58e483818189216d43b6d77036.tar.gz mruby-6975258efd567c58e483818189216d43b6d77036.zip | |
The proc with top-level env must be 'proc-closure'; fix #3871
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -2019,8 +2019,15 @@ RETRY_TRY_BLOCK: if (!MRB_PROC_ENV_P(proc) || !MRB_ENV_STACK_SHARED_P(MRB_PROC_ENV(proc))) { goto L_BREAK_ERROR; } - if (MRB_PROC_ENV(proc)->cxt != mrb->c) { - goto L_BREAK_ERROR; + else { + struct REnv *e = MRB_PROC_ENV(proc); + + if (e == mrb->c->cibase->env && proc != mrb->c->cibase->proc) { + goto L_BREAK_ERROR; + } + if (e->cxt != mrb->c) { + goto L_BREAK_ERROR; + } } while (mrb->c->eidx > mrb->c->ci->epos) { ecall_adjust(); |
