Check env stack length before `OP_SETUPVAR`; ref
MODIFY
src/vm.c
src/vm.c
@@ -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;
}

Check env stack length before `OP_SETUPVAR`; ref #3643