mirror of
https://github.com/lua/lua
synced 2024-12-25 20:06:50 +03:00
two bugs: invalid boolean values in constant table + too deep recursion
when reading nested functions
This commit is contained in:
parent
ffdca3522e
commit
facb0519a0
@ -1,5 +1,5 @@
|
||||
/*
|
||||
** $Id: lundump.c,v 2.7 2006/02/17 15:51:03 roberto Exp roberto $
|
||||
** $Id: lundump.c,v 2.8 2006/09/11 14:07:24 roberto Exp roberto $
|
||||
** load precompiled Lua chunks
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
@ -113,7 +113,7 @@ static void LoadConstants(LoadState* S, Proto* f)
|
||||
setnilvalue(o);
|
||||
break;
|
||||
case LUA_TBOOLEAN:
|
||||
setbvalue(o,LoadChar(S));
|
||||
setbvalue(o,LoadChar(S)!=0);
|
||||
break;
|
||||
case LUA_TNUMBER:
|
||||
setnvalue(o,LoadNumber(S));
|
||||
@ -159,7 +159,9 @@ static void LoadDebug(LoadState* S, Proto* f)
|
||||
|
||||
static Proto* LoadFunction(LoadState* S, TString* p)
|
||||
{
|
||||
Proto* f=luaF_newproto(S->L);
|
||||
Proto* f;
|
||||
if (++G(S->L)->nCcalls > LUAI_MAXCCALLS) error(S, "function nest too deep");
|
||||
f=luaF_newproto(S->L);
|
||||
setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
|
||||
f->source=LoadString(S); if (f->source==NULL) f->source=p;
|
||||
f->linedefined=LoadInt(S);
|
||||
@ -173,6 +175,7 @@ static Proto* LoadFunction(LoadState* S, TString* p)
|
||||
LoadDebug(S,f);
|
||||
IF (!luaG_checkcode(f), "bad code");
|
||||
S->L->top--;
|
||||
G(S->L)->nCcalls--;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user