mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-02-07 15:14:08 +00:00
DynASM/x86: Fix potential REL_A overflow.
Thanks to Joshua Haberman.
This commit is contained in:
parent
f3d75075ed
commit
0c0e7b168e
@ -395,7 +395,8 @@ int dasm_encode(Dst_DECL, void *buffer)
|
|||||||
case DASM_VREG: { int t = *p++; if (t >= 2) n<<=3; cp[-1] |= n; break; }
|
case DASM_VREG: { int t = *p++; if (t >= 2) n<<=3; cp[-1] |= n; break; }
|
||||||
case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
|
case DASM_REL_LG: p++; if (n >= 0) goto rel_pc;
|
||||||
b++; n = (int)(ptrdiff_t)D->globals[-n];
|
b++; n = (int)(ptrdiff_t)D->globals[-n];
|
||||||
case DASM_REL_A: rel_a: n -= (int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
|
case DASM_REL_A: rel_a:
|
||||||
|
n -= (unsigned int)(ptrdiff_t)(cp+4); goto wd; /* !x64 */
|
||||||
case DASM_REL_PC: rel_pc: {
|
case DASM_REL_PC: rel_pc: {
|
||||||
int shrink = *b++;
|
int shrink = *b++;
|
||||||
int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
|
int *pb = DASM_POS2PTR(D, n); if (*pb < 0) { n = pb[1]; goto rel_a; }
|
||||||
|
Loading…
Reference in New Issue
Block a user