diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-29 13:44:51 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-12-29 13:44:51 -0200 |
commit | 28323aeaa6963e53171b1855cc4a51b519985f48 (patch) | |
tree | 02ad1dbccd6213ff4516b66c3b4a249f46654c90 | |
parent | cf7eff45f3abf2386d5392c0b431498bbb274ac7 (diff) | |
download | lua-28323aeaa6963e53171b1855cc4a51b519985f48.tar.gz lua-28323aeaa6963e53171b1855cc4a51b519985f48.tar.bz2 lua-28323aeaa6963e53171b1855cc4a51b519985f48.zip |
by-one error when filling missing arguments in a tail call
-rw-r--r-- | ldo.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.183 2017/12/20 14:58:05 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.184 2017/12/28 14:17:09 roberto Exp roberto $ |
3 | ** Stack and Call structure of Lua | 3 | ** Stack and Call structure of Lua |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -418,8 +418,8 @@ void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n) { | |||
418 | for (i = 0; i < n; i++) /* move down function and arguments */ | 418 | for (i = 0; i < n; i++) /* move down function and arguments */ |
419 | setobjs2s(L, ci->func + i, func + i); | 419 | setobjs2s(L, ci->func + i, func + i); |
420 | checkstackp(L, fsize, func); | 420 | checkstackp(L, fsize, func); |
421 | for (; i < p->numparams; i++) | 421 | for (; i <= p->numparams; i++) |
422 | setnilvalue(s2v(ci->func + i)); /* complete missing parameters */ | 422 | setnilvalue(s2v(ci->func + i)); /* complete missing arguments */ |
423 | if (p->is_vararg) { | 423 | if (p->is_vararg) { |
424 | L->top -= (func - ci->func); /* move down top */ | 424 | L->top -= (func - ci->func); /* move down top */ |
425 | luaT_adjustvarargs(L, p, n - 1); | 425 | luaT_adjustvarargs(L, p, n - 1); |