mirror of
https://github.com/lua/lua.git
synced 2025-07-04 15:09:38 +00:00
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:
parent
cd4de92762
commit
a546138d15
3 changed files with 17 additions and 4 deletions
2
lcode.c
2
lcode.c
|
@ -724,6 +724,8 @@ static void const2exp (TValue *v, expdesc *e) {
|
|||
*/
|
||||
void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) {
|
||||
Instruction *pc = &getinstruction(fs, e);
|
||||
if (nresults + 1 > MAXARG_C)
|
||||
luaX_syntaxerror(fs->ls, "too many multiple results");
|
||||
if (e->k == VCALL) /* expression is an open function call? */
|
||||
SETARG_C(*pc, nresults + 1);
|
||||
else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue