Prevent recording of loops with -0 step or NaN values.
Thanks to Sergey Kaplun. #1432 #1433
This commit is contained in:
@@ -526,6 +526,12 @@ static LoopEvent rec_for(jit_State *J, const BCIns *fori, int isforl)
|
|||||||
LoopEvent ev;
|
LoopEvent ev;
|
||||||
TRef stop;
|
TRef stop;
|
||||||
IRType t;
|
IRType t;
|
||||||
|
/* Avoid semantic mismatches and always failing guards. */
|
||||||
|
if (tvisnan(&tv[FORL_IDX]) ||
|
||||||
|
tvisnan(&tv[FORL_STOP]) ||
|
||||||
|
tvisnan(&tv[FORL_STEP]) ||
|
||||||
|
tvismzero(&tv[FORL_STEP]))
|
||||||
|
lj_trace_err(J, LJ_TRERR_GFAIL);
|
||||||
if (isforl) { /* Handle FORL/JFORL opcodes. */
|
if (isforl) { /* Handle FORL/JFORL opcodes. */
|
||||||
TRef idx = tr[FORL_IDX];
|
TRef idx = tr[FORL_IDX];
|
||||||
if (mref(J->scev.pc, const BCIns) == fori && tref_ref(idx) == J->scev.idx) {
|
if (mref(J->scev.pc, const BCIns) == fori && tref_ref(idx) == J->scev.idx) {
|
||||||
|
|||||||
Reference in New Issue
Block a user