From b9f944491df2f6ff0f0521e6b692bfed6afcd90c Mon Sep 17 00:00:00 2001 From: Lua Team Date: Tue, 1 May 2007 00:00:00 -0400 Subject: [PATCH] Fix: Count hook may be called without being set Reported by Mike Pall in May 2007 --- src/lvm.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lvm.c b/src/lvm.c index 08802f4..1d173d7 100644 --- a/src/lvm.c +++ b/src/lvm.c @@ -61,11 +61,9 @@ static void traceexec (lua_State *L, const Instruction *pc) { lu_byte mask = L->hookmask; const Instruction *oldpc = L->savedpc; L->savedpc = pc; - if (mask > LUA_MASKLINE) { /* instruction-hook set? */ - if (L->hookcount == 0) { - resethookcount(L); - luaD_callhook(L, LUA_HOOKCOUNT, -1); - } + if ((mask & LUA_MASKCOUNT) && L->hookcount == 0) { + resethookcount(L); + luaD_callhook(L, LUA_HOOKCOUNT, -1); } if (mask & LUA_MASKLINE) { Proto *p = ci_func(L->ci)->l.p; -- 2.11.4.GIT