diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-15 18:32:27 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-10-15 18:32:27 +0900 |
| commit | c779413df39ef7d96583bda08104491c55049fad (patch) | |
| tree | 617c2c239bf4f658b89607d93615bbd9fb4c5dec /mrbgems/mruby-compiler/core | |
| parent | 9cebddf9fe83ae0acde6f64f291fa3c9fc22880f (diff) | |
| download | mruby-c779413df39ef7d96583bda08104491c55049fad.tar.gz mruby-c779413df39ef7d96583bda08104491c55049fad.zip | |
Fix out of bound access in `parse.y`.
Diffstat (limited to 'mrbgems/mruby-compiler/core')
| -rw-r--r-- | mrbgems/mruby-compiler/core/parse.y | 2 | ||||
| -rw-r--r-- | mrbgems/mruby-compiler/core/y.tab.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/parse.y b/mrbgems/mruby-compiler/core/parse.y index 3cd74971f..6409f0b3d 100644 --- a/mrbgems/mruby-compiler/core/parse.y +++ b/mrbgems/mruby-compiler/core/parse.y @@ -284,7 +284,7 @@ local_var_p(parser_state *p, mrb_sym sym) int i; if (!v) break; - for (i=0; i < ir->nlocals; i++) { + for (i=0; i+1 < ir->nlocals; i++) { if (v[i] == sym) return TRUE; } if (MRB_PROC_SCOPE_P(u)) break; diff --git a/mrbgems/mruby-compiler/core/y.tab.c b/mrbgems/mruby-compiler/core/y.tab.c index b28509d81..becf886c5 100644 --- a/mrbgems/mruby-compiler/core/y.tab.c +++ b/mrbgems/mruby-compiler/core/y.tab.c @@ -347,7 +347,7 @@ local_var_p(parser_state *p, mrb_sym sym) int i; if (!v) break; - for (i=0; i < ir->nlocals; i++) { + for (i=0; i+1 < ir->nlocals; i++) { if (v[i] == sym) return TRUE; } if (MRB_PROC_SCOPE_P(u)) break; |
