mirror of
https://github.com/lua/lua
synced 2025-01-13 04:49:17 +03:00
API functions check stack overflow
This commit is contained in:
parent
30f6e658d2
commit
2779e81fbb
7
lapi.c
7
lapi.c
@ -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
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** 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 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) {
|
void lua_getglobal (lua_State *L, const char *name) {
|
||||||
StkId top = L->top;
|
StkId top = L->top;
|
||||||
*top = *luaV_getglobal(L, luaS_new(L, name));
|
*top = *luaV_getglobal(L, luaS_new(L, name));
|
||||||
L->top = top+1;
|
L->top = top;
|
||||||
|
api_incr_top(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
5
ltm.c
5
ltm.c
@ -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
|
** Tag methods
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@ -11,6 +11,7 @@
|
|||||||
#include "lua.h"
|
#include "lua.h"
|
||||||
|
|
||||||
#include "lauxlib.h"
|
#include "lauxlib.h"
|
||||||
|
#include "ldo.h"
|
||||||
#include "lmem.h"
|
#include "lmem.h"
|
||||||
#include "lobject.h"
|
#include "lobject.h"
|
||||||
#include "lstate.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);
|
*L->top = *luaT_getim(L, t,e);
|
||||||
else
|
else
|
||||||
ttype(L->top) = TAG_NIL;
|
ttype(L->top) = TAG_NIL;
|
||||||
L->top++;
|
incr_top;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user