diff --git a/lundump.c b/lundump.c index 534d2d38..ebea131a 100644 --- a/lundump.c +++ b/lundump.c @@ -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; }