Fix embedded bytecode loader.
This commit is contained in:
@@ -49,6 +49,10 @@ static int fillbuf(LexState *ls)
|
||||
size_t sz;
|
||||
const char *buf = ls->rfunc(ls->L, ls->rdata, &sz);
|
||||
if (buf == NULL || sz == 0) return END_OF_STREAM;
|
||||
if (sz >= LJ_MAX_MEM) {
|
||||
if (sz != ~(size_t)0) lj_err_mem(ls->L);
|
||||
ls->endmark = 1;
|
||||
}
|
||||
ls->n = (MSize)sz - 1;
|
||||
ls->p = buf;
|
||||
return char2int(*(ls->p++));
|
||||
@@ -382,6 +386,7 @@ int lj_lex_setup(lua_State *L, LexState *ls)
|
||||
ls->lookahead = TK_eof; /* No look-ahead token. */
|
||||
ls->linenumber = 1;
|
||||
ls->lastline = 1;
|
||||
ls->endmark = 0;
|
||||
lj_str_resizebuf(ls->L, &ls->sb, LJ_MIN_SBUF);
|
||||
next(ls); /* Read-ahead first char. */
|
||||
if (ls->current == 0xef && ls->n >= 2 && char2int(ls->p[0]) == 0xbb &&
|
||||
|
||||
Reference in New Issue
Block a user