diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-04-12 22:52:26 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2019-04-12 22:52:26 +0900 |
| commit | 00545fc51d33a9c71d610cc8da5e779cf29487af (patch) | |
| tree | fa31197fdfe26786230c72547e52da9df25f5e9a | |
| parent | 6da10f643ab8453d0bbe66258df6b756d2326d65 (diff) | |
| download | mruby-00545fc51d33a9c71d610cc8da5e779cf29487af.tar.gz mruby-00545fc51d33a9c71d610cc8da5e779cf29487af.zip | |
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.
| -rw-r--r-- | mrbgems/mruby-compiler/core/codegen.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c index 927cc3a0f..4bb81f415 100644 --- a/mrbgems/mruby-compiler/core/codegen.c +++ b/mrbgems/mruby-compiler/core/codegen.c @@ -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); |
