diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-23 16:44:11 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-23 16:44:11 +0900 |
| commit | ffb5e5ab08624c899de03b5347966eb3e070dce5 (patch) | |
| tree | b69330438bb503a604a82c9a13459fee1fb2208c /src/vm.c | |
| parent | 324887d0d61ce2127dfd839930a88507c1641b75 (diff) | |
| download | mruby-ffb5e5ab08624c899de03b5347966eb3e070dce5.tar.gz mruby-ffb5e5ab08624c899de03b5347966eb3e070dce5.zip | |
The ensure clause should keep its ci after its execution; fix #3406
This issue was reported by https://hackerone.com/ston3
Diffstat (limited to 'src/vm.c')
| -rw-r--r-- | src/vm.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -280,12 +280,14 @@ ecall(mrb_state *mrb, int i) mrb_callinfo *ci; mrb_value *self = mrb->c->stack; struct RObject *exc; + int cioff; if (i<0) return; p = mrb->c->ensure[i]; if (!p) return; if (mrb->c->ci->eidx > i) mrb->c->ci->eidx = i; + cioff = mrb->c->ci - mrb->c->cibase; ci = cipush(mrb); ci->stackent = mrb->c->stack; ci->mid = ci[-1].mid; @@ -298,6 +300,7 @@ ecall(mrb_state *mrb, int i) exc = mrb->exc; mrb->exc = 0; mrb_run(mrb, p, *self); mrb->c->ensure[i] = NULL; + mrb->c->ci = mrb->c->cibase + cioff; if (!mrb->exc) mrb->exc = exc; } |
