Explicit limit for number of results in a call
The parameter 'nresults' in 'lua_call' and similar functions has a limit of 250. It already had an undocumented (and unchecked) limit of SHRT_MAX, but it is seldom larger than 2.
This commit is contained in:
9
lapi.c
9
lapi.c
@@ -1022,10 +1022,15 @@ LUA_API int lua_setiuservalue (lua_State *L, int idx, int n) {
|
||||
*/
|
||||
|
||||
|
||||
#define MAXRESULTS 250
|
||||
|
||||
|
||||
#define checkresults(L,na,nr) \
|
||||
api_check(L, (nr) == LUA_MULTRET \
|
||||
(api_check(L, (nr) == LUA_MULTRET \
|
||||
|| (L->ci->top.p - L->top.p >= (nr) - (na)), \
|
||||
"results from function overflow current stack size")
|
||||
"results from function overflow current stack size"), \
|
||||
api_check(L, LUA_MULTRET <= (nr) && (nr) <= MAXRESULTS, \
|
||||
"invalid number of results"))
|
||||
|
||||
|
||||
LUA_API void lua_callk (lua_State *L, int nargs, int nresults,
|
||||
|
||||
Reference in New Issue
Block a user