Check env stack length before `OP_SETUPVAR`; ref
@@ -1084,9 +1084,12 @@ RETRY_TRY_BLOCK:
if (e) {
mrb_value *regs_a = regs + GETARG_A(i);
int idx = GETARG_B(i);
+
+ if (idx < MRB_ENV_STACK_LEN(e)) {
e->stack[idx] = *regs_a;
mrb_write_barrier(mrb, (struct RBasic*)e);
}
+ }
NEXT;
}
