mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 23:24:09 +00:00
Prevent loop in snap_usedef().
Reported by XmiliaH.
This commit is contained in:
parent
d87da3d5fe
commit
0e66fc9637
@ -214,7 +214,12 @@ static BCReg snap_usedef(jit_State *J, uint8_t *udf,
|
|||||||
BCReg minslot = bc_a(ins);
|
BCReg minslot = bc_a(ins);
|
||||||
if (op >= BC_FORI && op <= BC_JFORL) minslot += FORL_EXT;
|
if (op >= BC_FORI && op <= BC_JFORL) minslot += FORL_EXT;
|
||||||
else if (op >= BC_ITERL && op <= BC_JITERL) minslot += bc_b(pc[-2])-1;
|
else if (op >= BC_ITERL && op <= BC_JITERL) minslot += bc_b(pc[-2])-1;
|
||||||
else if (op == BC_UCLO) { pc += bc_j(ins); break; }
|
else if (op == BC_UCLO) {
|
||||||
|
ptrdiff_t delta = bc_j(ins);
|
||||||
|
if (delta < 0) return maxslot; /* Prevent loop. */
|
||||||
|
pc += delta;
|
||||||
|
break;
|
||||||
|
}
|
||||||
for (s = minslot; s < maxslot; s++) DEF_SLOT(s);
|
for (s = minslot; s < maxslot; s++) DEF_SLOT(s);
|
||||||
return minslot < maxslot ? minslot : maxslot;
|
return minslot < maxslot ? minslot : maxslot;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user