mirror of https://github.com/rusefi/lua.git
little better error messages for internal arrays overflows
This commit is contained in:
parent
a7c9e45c64
commit
d5a23dde90
9
lcode.c
9
lcode.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lcode.c,v 2.26 2006/06/22 16:12:59 roberto Exp roberto $
|
** $Id: lcode.c,v 2.27 2006/08/07 19:14:30 roberto Exp roberto $
|
||||||
** Code generator for Lua
|
** Code generator for Lua
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -235,8 +235,7 @@ static int addk (FuncState *fs, TValue *key, TValue *v) {
|
||||||
int oldsize = f->sizek;
|
int oldsize = f->sizek;
|
||||||
k = fs->nk;
|
k = fs->nk;
|
||||||
setnvalue(idx, cast_num(k));
|
setnvalue(idx, cast_num(k));
|
||||||
luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Bx,
|
luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Bx, "constant table");
|
||||||
"constant table overflow");
|
|
||||||
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
|
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
|
||||||
setobj(L, &f->k[k], v);
|
setobj(L, &f->k[k], v);
|
||||||
fs->nk++;
|
fs->nk++;
|
||||||
|
@ -787,11 +786,11 @@ static int luaK_code (FuncState *fs, Instruction i, int line) {
|
||||||
dischargejpc(fs); /* `pc' will change */
|
dischargejpc(fs); /* `pc' will change */
|
||||||
/* put new instruction in code array */
|
/* put new instruction in code array */
|
||||||
luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
|
luaM_growvector(fs->L, f->code, fs->pc, f->sizecode, Instruction,
|
||||||
MAX_INT, "code size overflow");
|
MAX_INT, "code size");
|
||||||
f->code[fs->pc] = i;
|
f->code[fs->pc] = i;
|
||||||
/* save corresponding line information */
|
/* save corresponding line information */
|
||||||
luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
|
luaM_growvector(fs->L, f->lineinfo, fs->pc, f->sizelineinfo, int,
|
||||||
MAX_INT, "code size overflow");
|
MAX_INT, "code size");
|
||||||
f->lineinfo[fs->pc] = line;
|
f->lineinfo[fs->pc] = line;
|
||||||
return fs->pc++;
|
return fs->pc++;
|
||||||
}
|
}
|
||||||
|
|
4
lmem.c
4
lmem.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lmem.c,v 1.70 2005/12/26 13:35:47 roberto Exp roberto $
|
** $Id: lmem.c,v 1.71 2006/07/11 15:53:29 roberto Exp roberto $
|
||||||
** Interface to Memory Manager
|
** Interface to Memory Manager
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -50,7 +50,7 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
|
||||||
int newsize;
|
int newsize;
|
||||||
if (*size >= limit/2) { /* cannot double it? */
|
if (*size >= limit/2) { /* cannot double it? */
|
||||||
if (*size >= limit) /* cannot grow even a little? */
|
if (*size >= limit) /* cannot grow even a little? */
|
||||||
luaG_runerror(L, errormsg);
|
luaG_runerror(L, "%s overflow (limit is %d)", errormsg, limit);
|
||||||
newsize = limit; /* still have at least one free place */
|
newsize = limit; /* still have at least one free place */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lparser.c,v 2.45 2006/07/12 19:02:50 roberto Exp roberto $
|
** $Id: lparser.c,v 2.46 2006/08/15 19:59:20 roberto Exp roberto $
|
||||||
** Lua Parser
|
** Lua Parser
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -145,7 +145,7 @@ static int registerlocalvar (LexState *ls, TString *varname) {
|
||||||
Proto *f = fs->f;
|
Proto *f = fs->f;
|
||||||
int oldsize = f->sizelocvars;
|
int oldsize = f->sizelocvars;
|
||||||
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
|
luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars,
|
||||||
LocVar, SHRT_MAX, "too many local variables");
|
LocVar, SHRT_MAX, "local-variable table");
|
||||||
while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
|
while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL;
|
||||||
f->locvars[fs->nlocvars].varname = varname;
|
f->locvars[fs->nlocvars].varname = varname;
|
||||||
luaC_objbarrier(ls->L, f, varname);
|
luaC_objbarrier(ls->L, f, varname);
|
||||||
|
@ -314,7 +314,7 @@ static void pushclosure (LexState *ls, FuncState *func, expdesc *v) {
|
||||||
int oldsize = f->sizep;
|
int oldsize = f->sizep;
|
||||||
int i;
|
int i;
|
||||||
luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,
|
luaM_growvector(ls->L, f->p, fs->np, f->sizep, Proto *,
|
||||||
MAXARG_Bx, "constant table overflow");
|
MAXARG_Bx, "constant table");
|
||||||
while (oldsize < f->sizep) f->p[oldsize++] = NULL;
|
while (oldsize < f->sizep) f->p[oldsize++] = NULL;
|
||||||
f->p[fs->np++] = func->f;
|
f->p[fs->np++] = func->f;
|
||||||
luaC_objbarrier(ls->L, f, func->f);
|
luaC_objbarrier(ls->L, f, func->f);
|
||||||
|
|
Loading…
Reference in New Issue