Fix potential hang in UCLO redirection handling in hooks.

This commit is contained in:
Mike Pall 2010-03-10 22:13:23 +01:00
parent c56d791316
commit 4f19a15bd9

View File

@ -333,15 +333,13 @@ static void callhook(lua_State *L, int event, BCLine line)
static BCReg cur_topslot(GCproto *pt, const BCIns *pc, uint32_t nres) static BCReg cur_topslot(GCproto *pt, const BCIns *pc, uint32_t nres)
{ {
BCIns ins = pc[-1]; BCIns ins = pc[-1];
for (;;) { if (bc_op(ins) == BC_UCLO)
switch (bc_op(ins)) { ins = pc[bc_j(ins)];
case BC_UCLO: ins = pc[bc_j(ins)]; break; switch (bc_op(ins)) {
case BC_CALLM: case BC_CALLM: case BC_CALLMT: return bc_a(ins) + bc_c(ins) + nres-1+1;
case BC_CALLMT: return bc_a(ins) + bc_c(ins) + nres-1+1; case BC_RETM: return bc_a(ins) + bc_d(ins) + nres-1;
case BC_RETM: return bc_a(ins) + bc_d(ins) + nres-1; case BC_TSETM: return bc_a(ins) + nres-1;
case BC_TSETM: return bc_a(ins) + nres-1; default: return pt->framesize;
default: return pt->framesize;
}
} }
} }