The number of local variables should be less than 1024; fix #4370

The `env` stores stack length in a 10 bit field.
See `MRB_ENV_STACK_LEN()` macro.
parent 6da10f64
......@@ -3020,6 +3020,9 @@ scope_finish(codegen_scope *s)
mrb_state *mrb = s->mrb;
mrb_irep *irep = s->irep;
if (s->nlocals >= 0x3ff) {
codegen_error(s, "too many local variables");
}
irep->flags = 0;
if (s->iseq) {
irep->iseq = (mrb_code *)codegen_realloc(s, s->iseq, sizeof(mrb_code)*s->pc);
......
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