mirror of
https://github.com/lua/lua
synced 2025-01-13 12:59:17 +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
|
** load precompiled Lua chunks
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -113,7 +113,7 @@ static void LoadConstants(LoadState* S, Proto* f)
|
|||||||
setnilvalue(o);
|
setnilvalue(o);
|
||||||
break;
|
break;
|
||||||
case LUA_TBOOLEAN:
|
case LUA_TBOOLEAN:
|
||||||
setbvalue(o,LoadChar(S));
|
setbvalue(o,LoadChar(S)!=0);
|
||||||
break;
|
break;
|
||||||
case LUA_TNUMBER:
|
case LUA_TNUMBER:
|
||||||
setnvalue(o,LoadNumber(S));
|
setnvalue(o,LoadNumber(S));
|
||||||
@ -159,7 +159,9 @@ static void LoadDebug(LoadState* S, Proto* f)
|
|||||||
|
|
||||||
static Proto* LoadFunction(LoadState* S, TString* p)
|
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);
|
setptvalue2s(S->L,S->L->top,f); incr_top(S->L);
|
||||||
f->source=LoadString(S); if (f->source==NULL) f->source=p;
|
f->source=LoadString(S); if (f->source==NULL) f->source=p;
|
||||||
f->linedefined=LoadInt(S);
|
f->linedefined=LoadInt(S);
|
||||||
@ -173,6 +175,7 @@ static Proto* LoadFunction(LoadState* S, TString* p)
|
|||||||
LoadDebug(S,f);
|
LoadDebug(S,f);
|
||||||
IF (!luaG_checkcode(f), "bad code");
|
IF (!luaG_checkcode(f), "bad code");
|
||||||
S->L->top--;
|
S->L->top--;
|
||||||
|
G(S->L)->nCcalls--;
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user