diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-17 16:22:00 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-02-17 16:22:00 -0200 |
commit | 104d249ffbf76828caa5e204979f5ddad45f2bcb (patch) | |
tree | 40e6c53872ba42d4887ccd0eb391accc66edbcee | |
parent | c7a8cba74512a16aa01a99f2cdf395b358ada2fc (diff) | |
download | lua-104d249ffbf76828caa5e204979f5ddad45f2bcb.tar.gz lua-104d249ffbf76828caa5e204979f5ddad45f2bcb.tar.bz2 lua-104d249ffbf76828caa5e204979f5ddad45f2bcb.zip |
in return hook, 'top' must be corrected only if smaller than 'ci->top'.
(It may be larger when returning multiple values, and then it must
be larger to preserve that stack slice.)
-rw-r--r-- | ldo.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ldo.c,v 2.193 2018/02/09 15:16:06 roberto Exp roberto $ | 2 | ** $Id: ldo.c,v 2.194 2018/02/15 15:34:29 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 | */ |
@@ -316,7 +316,8 @@ static void rethook (lua_State *L, CallInfo *ci) { | |||
316 | Proto *p = clLvalue(s2v(ci->func))->p; | 316 | Proto *p = clLvalue(s2v(ci->func))->p; |
317 | if (p->is_vararg) | 317 | if (p->is_vararg) |
318 | delta = ci->u.l.nextraargs + p->numparams + 1; | 318 | delta = ci->u.l.nextraargs + p->numparams + 1; |
319 | L->top = ci->top; /* prepare top */ | 319 | if (L->top < ci->top) |
320 | L->top = ci->top; /* correct top */ | ||
320 | } | 321 | } |
321 | if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ | 322 | if (L->hookmask & LUA_MASKRET) { /* is return hook on? */ |
322 | ci->func += delta; /* if vararg, back to virtual 'func' */ | 323 | ci->func += delta; /* if vararg, back to virtual 'func' */ |