bug: interpreter cannot pop activation frame before calling return

hook (as it may want to access local variables active by the end
of the function)
This commit is contained in:
Roberto Ierusalimschy
2015-05-22 14:48:19 -03:00
parent 6142e663e4
commit d39bb51faa
3 changed files with 13 additions and 14 deletions

5
lvm.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lvm.c,v 2.241 2015/05/20 16:22:55 roberto Exp roberto $
** $Id: lvm.c,v 2.242 2015/05/20 18:19:11 roberto Exp roberto $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -1106,9 +1106,8 @@ void luaV_execute (lua_State *L) {
}
vmcase(OP_RETURN) {
int b = GETARG_B(i);
if (b != 0) L->top = ra+b-1;
if (cl->p->sizep > 0) luaF_close(L, base);
b = luaD_poscall(L, ra);
b = luaD_poscall(L, ra, (b != 0 ? b - 1 : L->top - ra));
if (!(ci->callstatus & CIST_REENTRY)) /* 'ci' still the called one */
return; /* external invocation: return */
else { /* invocation via reentry: continue execution */