summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2016-12-13 02:32:50 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2016-12-13 02:33:28 +0900
commit647ad29a7a1147e2c3ed93329cabbb974482697f (patch)
tree6af53876924b4cf6d31246c57117f444f06f408e
parenta4ae22ae0cfe5efe420cb6b8c68c6ebadb9cead8 (diff)
downloadmruby-647ad29a7a1147e2c3ed93329cabbb974482697f.tar.gz
mruby-647ad29a7a1147e2c3ed93329cabbb974482697f.zip
Fixed wrong condition in new_sym() that breaks symbol data.
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index 33d3f96d4..90bafb3c2 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -537,7 +537,8 @@ new_sym(codegen_scope *s, mrb_sym sym)
if (s->irep->slen == MAXSYMLEN) {
codegen_error(s, "too many symbols (max " MRB_STRINGIZE(MAXSYMLEN) ")");
}
- if (s->scapa == MAXMSYMLEN) {
+
+ if (s->irep->slen > MAXMSYMLEN/2 && s->scapa == MAXMSYMLEN) {
s->scapa = MAXSYMLEN;
s->irep->syms = (mrb_sym *)codegen_realloc(s, s->irep->syms, sizeof(mrb_sym)*MAXSYMLEN);
for (i = s->irep->slen; i < MAXMSYMLEN; i++) {