diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 16:45:27 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-09-11 16:45:27 -0300 |
commit | 2779e81fbbdebf8b7cac97c167ff109bad537c4b (patch) | |
tree | c974209192b1380b9e6c7884f923647041f4d8fa | |
parent | 30f6e658d2071d23309e4ac70dd8ec199049aff4 (diff) | |
download | lua-github-2779e81fbbdebf8b7cac97c167ff109bad537c4b.tar.gz |
API functions check stack overflow
-rw-r--r-- | lapi.c | 7 | ||||
-rw-r--r-- | ltm.c | 5 |
2 files changed, 7 insertions, 5 deletions
@@ -1,5 +1,5 @@ /* -** $Id: lapi.c,v 1.93 2000/08/31 21:01:43 roberto Exp roberto $ +** $Id: lapi.c,v 1.94 2000/09/05 19:33:32 roberto Exp roberto $ ** Lua API ** See Copyright Notice in lua.h */ @@ -30,7 +30,7 @@ const char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n" #define Index(L,i) ((i) >= 0 ? (L->Cbase+((i)-1)) : (L->top+(i))) -#define api_incr_top(L) (++L->top) +#define api_incr_top(L) incr_top @@ -250,7 +250,8 @@ void lua_pushusertag (lua_State *L, void *u, int tag) { /* ORDER LUA_T */ void lua_getglobal (lua_State *L, const char *name) { StkId top = L->top; *top = *luaV_getglobal(L, luaS_new(L, name)); - L->top = top+1; + L->top = top; + api_incr_top(L); } @@ -1,5 +1,5 @@ /* -** $Id: ltm.c,v 1.46 2000/08/09 19:16:57 roberto Exp roberto $ +** $Id: ltm.c,v 1.47 2000/09/05 19:33:32 roberto Exp roberto $ ** Tag methods ** See Copyright Notice in lua.h */ @@ -11,6 +11,7 @@ #include "lua.h" #include "lauxlib.h" +#include "ldo.h" #include "lmem.h" #include "lobject.h" #include "lstate.h" @@ -127,7 +128,7 @@ void lua_gettagmethod (lua_State *L, int t, const char *event) { *L->top = *luaT_getim(L, t,e); else ttype(L->top) = TAG_NIL; - L->top++; + incr_top; } |