Browse Source

Followup fix for embedded bytecode loader.

Mike Pall 5 years ago
parent
commit
e49863eda1
1 changed files with 1 additions and 0 deletions
  1. 1 0
      src/lj_lex.c

+ 1 - 0
src/lj_lex.c

@@ -51,6 +51,7 @@ static LJ_NOINLINE LexChar lex_more(LexState *ls)
   if (sz >= LJ_MAX_BUF) {
   if (sz >= LJ_MAX_BUF) {
     if (sz != ~(size_t)0) lj_err_mem(ls->L);
     if (sz != ~(size_t)0) lj_err_mem(ls->L);
     sz = ~(uintptr_t)0 - (uintptr_t)p;
     sz = ~(uintptr_t)0 - (uintptr_t)p;
+    if (sz >= LJ_MAX_BUF) sz = LJ_MAX_BUF-1;
     ls->endmark = 1;
     ls->endmark = 1;
   }
   }
   ls->pe = p + sz;
   ls->pe = p + sz;