From 28323aeaa6963e53171b1855cc4a51b519985f48 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Fri, 29 Dec 2017 13:44:51 -0200 Subject: by-one error when filling missing arguments in a tail call --- ldo.c | 6 +++--- 1 file 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 @@ /* -** $Id: ldo.c,v 2.183 2017/12/20 14:58:05 roberto Exp roberto $ +** $Id: ldo.c,v 2.184 2017/12/28 14:17:09 roberto Exp roberto $ ** Stack and Call structure of Lua ** See Copyright Notice in lua.h */ @@ -418,8 +418,8 @@ void luaD_pretailcall (lua_State *L, CallInfo *ci, StkId func, int n) { for (i = 0; i < n; i++) /* move down function and arguments */ setobjs2s(L, ci->func + i, func + i); checkstackp(L, fsize, func); - for (; i < p->numparams; i++) - setnilvalue(s2v(ci->func + i)); /* complete missing parameters */ + for (; i <= p->numparams; i++) + setnilvalue(s2v(ci->func + i)); /* complete missing arguments */ if (p->is_vararg) { L->top -= (func - ci->func); /* move down top */ luaT_adjustvarargs(L, p, n - 1); -- cgit v1.2.3-55-g6feb