diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-01 15:51:23 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2014-04-01 15:51:23 -0300 |
commit | 493b3fdd6505bc5e97acfbd9e1596b45d9033f11 (patch) | |
tree | 69ddc97e7434c6fedf73121e56ebf0a8b9f2ae66 /lapi.c | |
parent | 315c5bf7b7ce65e8a12d1d6e9a5a027307a31b89 (diff) | |
download | lua-493b3fdd6505bc5e97acfbd9e1596b45d9033f11.tar.gz lua-493b3fdd6505bc5e97acfbd9e1596b45d9033f11.tar.bz2 lua-493b3fdd6505bc5e97acfbd9e1596b45d9033f11.zip |
added an 'api_check' for negative sizes in 'lua_checkstack'
Diffstat (limited to 'lapi.c')
-rw-r--r-- | lapi.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 2.200 2014/02/26 12:39:30 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.201 2014/03/12 20:57:40 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 | */ |
@@ -94,6 +94,7 @@ LUA_API int lua_checkstack (lua_State *L, int size) { | |||
94 | int res; | 94 | int res; |
95 | CallInfo *ci = L->ci; | 95 | CallInfo *ci = L->ci; |
96 | lua_lock(L); | 96 | lua_lock(L); |
97 | api_check(L, size >= 0, "negative 'size'"); | ||
97 | if (L->stack_last - L->top > size) /* stack large enough? */ | 98 | if (L->stack_last - L->top > size) /* stack large enough? */ |
98 | res = 1; /* yes; check is OK */ | 99 | res = 1; /* yes; check is OK */ |
99 | else { /* no; need to grow stack */ | 100 | else { /* no; need to grow stack */ |