aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-29 13:44:51 -0200
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-12-29 13:44:51 -0200
commit28323aeaa6963e53171b1855cc4a51b519985f48 (patch)
tree02ad1dbccd6213ff4516b66c3b4a249f46654c90
parentcf7eff45f3abf2386d5392c0b431498bbb274ac7 (diff)
downloadlua-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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ldo.c b/ldo.c
index 6a28e8ee..1abd105c 100644
--- a/ldo.c
+++ b/ldo.c
@@ -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);