Skip to content

Commit

Permalink
Fixed wrong condition in new_sym() that breaks symbol data.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Dec 12, 2016
1 parent a4ae22a commit 647ad29
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mrbgems/mruby-compiler/core/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit 647ad29

Please sign in to comment.