Fix off-by-one error in `OP_EPUSH` and `OP_ONERR`; fix #4095

parent e91b6a03
...@@ -1240,7 +1240,7 @@ RETRY_TRY_BLOCK: ...@@ -1240,7 +1240,7 @@ RETRY_TRY_BLOCK:
CASE(OP_ONERR, S) { CASE(OP_ONERR, S) {
/* check rescue stack */ /* 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_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested rescues");
mrb_exc_set(mrb, exc); mrb_exc_set(mrb, exc);
goto L_RAISE; goto L_RAISE;
...@@ -1306,7 +1306,7 @@ RETRY_TRY_BLOCK: ...@@ -1306,7 +1306,7 @@ RETRY_TRY_BLOCK:
p = mrb_closure_new(mrb, irep->reps[a]); p = mrb_closure_new(mrb, irep->reps[a]);
/* check ensure stack */ /* 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_value exc = mrb_exc_new_str_lit(mrb, E_RUNTIME_ERROR, "too many nested ensures");
mrb_exc_set(mrb, exc); mrb_exc_set(mrb, exc);
goto L_RAISE; goto L_RAISE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment