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.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2019-04-12 22:52:26 +09:00
parent 6da10f643a
commit 00545fc51d
+3
View File
@@ -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);