added an 'api_check' for negative sizes in 'lua_checkstack'
This commit is contained in:
3
lapi.c
3
lapi.c
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 2.200 2014/02/26 12:39:30 roberto Exp roberto $
|
** $Id: lapi.c,v 2.201 2014/03/12 20:57:40 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
@@ -94,6 +94,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) {
|
|||||||
int res;
|
int res;
|
||||||
CallInfo *ci = L->ci;
|
CallInfo *ci = L->ci;
|
||||||
lua_lock(L);
|
lua_lock(L);
|
||||||
|
api_check(L, size >= 0, "negative 'size'");
|
||||||
if (L->stack_last - L->top > size) /* stack large enough? */
|
if (L->stack_last - L->top > size) /* stack large enough? */
|
||||||
res = 1; /* yes; check is OK */
|
res = 1; /* yes; check is OK */
|
||||||
else { /* no; need to grow stack */
|
else { /* no; need to grow stack */
|
||||||
|
|||||||
Reference in New Issue
Block a user