aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-11 16:45:27 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-11 16:45:27 -0300
commit2779e81fbbdebf8b7cac97c167ff109bad537c4b (patch)
treec974209192b1380b9e6c7884f923647041f4d8fa
parent30f6e658d2071d23309e4ac70dd8ec199049aff4 (diff)
downloadlua-2779e81fbbdebf8b7cac97c167ff109bad537c4b.tar.gz
lua-2779e81fbbdebf8b7cac97c167ff109bad537c4b.tar.bz2
lua-2779e81fbbdebf8b7cac97c167ff109bad537c4b.zip
API functions check stack overflow
-rw-r--r--lapi.c7
-rw-r--r--ltm.c5
2 files changed, 7 insertions, 5 deletions
diff --git a/lapi.c b/lapi.c
index 4a80796a..dc103bc4 100644
--- a/lapi.c
+++ b/lapi.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lapi.c,v 1.93 2000/08/31 21:01:43 roberto Exp roberto $ 2** $Id: lapi.c,v 1.94 2000/09/05 19:33:32 roberto Exp roberto $
3** Lua API 3** Lua API
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -30,7 +30,7 @@ const char lua_ident[] = "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n"
30 30
31#define Index(L,i) ((i) >= 0 ? (L->Cbase+((i)-1)) : (L->top+(i))) 31#define Index(L,i) ((i) >= 0 ? (L->Cbase+((i)-1)) : (L->top+(i)))
32 32
33#define api_incr_top(L) (++L->top) 33#define api_incr_top(L) incr_top
34 34
35 35
36 36
@@ -250,7 +250,8 @@ void lua_pushusertag (lua_State *L, void *u, int tag) { /* ORDER LUA_T */
250void lua_getglobal (lua_State *L, const char *name) { 250void lua_getglobal (lua_State *L, const char *name) {
251 StkId top = L->top; 251 StkId top = L->top;
252 *top = *luaV_getglobal(L, luaS_new(L, name)); 252 *top = *luaV_getglobal(L, luaS_new(L, name));
253 L->top = top+1; 253 L->top = top;
254 api_incr_top(L);
254} 255}
255 256
256 257
diff --git a/ltm.c b/ltm.c
index 3d59b9a0..a1ed11dc 100644
--- a/ltm.c
+++ b/ltm.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: ltm.c,v 1.46 2000/08/09 19:16:57 roberto Exp roberto $ 2** $Id: ltm.c,v 1.47 2000/09/05 19:33:32 roberto Exp roberto $
3** Tag methods 3** Tag methods
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -11,6 +11,7 @@
11#include "lua.h" 11#include "lua.h"
12 12
13#include "lauxlib.h" 13#include "lauxlib.h"
14#include "ldo.h"
14#include "lmem.h" 15#include "lmem.h"
15#include "lobject.h" 16#include "lobject.h"
16#include "lstate.h" 17#include "lstate.h"
@@ -127,7 +128,7 @@ void lua_gettagmethod (lua_State *L, int t, const char *event) {
127 *L->top = *luaT_getim(L, t,e); 128 *L->top = *luaT_getim(L, t,e);
128 else 129 else
129 ttype(L->top) = TAG_NIL; 130 ttype(L->top) = TAG_NIL;
130 L->top++; 131 incr_top;
131} 132}
132 133
133 134