Skip to content

Commit

Permalink
in return hook, 'top' must be corrected only if smaller than 'ci->top'.
Browse files Browse the repository at this point in the history
(It may be larger when returning multiple values, and then it must
be larger to preserve that stack slice.)
  • Loading branch information
roberto-ieru committed Feb 17, 2018
1 parent c7a8cba commit 104d249
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ldo.c
Original file line number Diff line number Diff line change
@@ -1,5 1,5 @@
/*
** $Id: ldo.c,v 2.193 2018/02/09 15:16:06 roberto Exp roberto $
** $Id: ldo.c,v 2.194 2018/02/15 15:34:29 roberto Exp roberto $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
Expand Down Expand Up @@ -316,7 316,8 @@ static void rethook (lua_State *L, CallInfo *ci) {
Proto *p = clLvalue(s2v(ci->func))->p;
if (p->is_vararg)
delta = ci->u.l.nextraargs p->numparams 1;
L->top = ci->top; /* prepare top */
if (L->top < ci->top)
L->top = ci->top; /* correct top */
}
if (L->hookmask & LUA_MASKRET) { /* is return hook on? */
ci->func = delta; /* if vararg, back to virtual 'func' */
Expand Down

0 comments on commit 104d249

Please sign in to comment.