diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-29 23:59:20 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2018-08-29 23:59:20 +0900 |
| commit | f76cc483d55b58f2b5803b13cb5e528a67b39c3b (patch) | |
| tree | d8c36358dab4d5a7c3eebf6c1885fe59ab665dea /src | |
| parent | e91b6a037812031a349e76d3f51effacc3908dc5 (diff) | |
| download | mruby-f76cc483d55b58f2b5803b13cb5e528a67b39c3b.tar.gz mruby-f76cc483d55b58f2b5803b13cb5e528a67b39c3b.zip | |
Fix off-by-one error in `OP_EPUSH` and `OP_ONERR`; fix #4095
Diffstat (limited to 'src')
| -rw-r--r-- | src/vm.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1240,7 +1240,7 @@ RETRY_TRY_BLOCK: CASE(OP_ONERR, S) { /* check rescue stack */ - if (mrb->c->ci->ridx == UINT16_MAX) { + if (mrb->c->ci->ridx == UINT16_MAX-1) { mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested rescues"); mrb_exc_set(mrb, exc); goto L_RAISE; @@ -1306,7 +1306,7 @@ RETRY_TRY_BLOCK: p = mrb_closure_new(mrb, irep->reps[a]); /* check ensure stack */ - if (mrb->c->eidx == UINT16_MAX) { + if (mrb->c->eidx == UINT16_MAX-1) { mrb_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested ensures"); mrb_exc_set(mrb, exc); goto L_RAISE; |
