diff options
author | Mike Pall <mike> | 2021-07-23 21:33:59 +0200 |
---|---|---|
committer | Mike Pall <mike> | 2021-07-23 21:33:59 +0200 |
commit | 0e66fc96377853d898390f1a02723c54ec3a42f7 (patch) | |
tree | 2abd8d910800c7a0e9a253328e08158a48d1bc51 /src | |
parent | d87da3d5fed7f046c426d6a747bb84c2880f4e8d (diff) | |
download | luajit-0e66fc96377853d898390f1a02723c54ec3a42f7.tar.gz luajit-0e66fc96377853d898390f1a02723c54ec3a42f7.tar.bz2 luajit-0e66fc96377853d898390f1a02723c54ec3a42f7.zip |
Prevent loop in snap_usedef().
Reported by XmiliaH.
Diffstat (limited to 'src')
-rw-r--r-- | src/lj_snap.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/lj_snap.c b/src/lj_snap.c index eb14058e..91880fcf 100644 --- a/src/lj_snap.c +++ b/src/lj_snap.c | |||
@@ -214,7 +214,12 @@ static BCReg snap_usedef(jit_State *J, uint8_t *udf, | |||
214 | BCReg minslot = bc_a(ins); | 214 | BCReg minslot = bc_a(ins); |
215 | if (op >= BC_FORI && op <= BC_JFORL) minslot += FORL_EXT; | 215 | if (op >= BC_FORI && op <= BC_JFORL) minslot += FORL_EXT; |
216 | else if (op >= BC_ITERL && op <= BC_JITERL) minslot += bc_b(pc[-2])-1; | 216 | else if (op >= BC_ITERL && op <= BC_JITERL) minslot += bc_b(pc[-2])-1; |
217 | else if (op == BC_UCLO) { pc += bc_j(ins); break; } | 217 | else if (op == BC_UCLO) { |
218 | ptrdiff_t delta = bc_j(ins); | ||
219 | if (delta < 0) return maxslot; /* Prevent loop. */ | ||
220 | pc += delta; | ||
221 | break; | ||
222 | } | ||
218 | for (s = minslot; s < maxslot; s++) DEF_SLOT(s); | 223 | for (s = minslot; s < maxslot; s++) DEF_SLOT(s); |
219 | return minslot < maxslot ? minslot : maxslot; | 224 | return minslot < maxslot ? minslot : maxslot; |
220 | } | 225 | } |