diff options
author | Wierschem, Keola <[email protected]> | 2022-01-12 22:58:46 -0800 |
---|---|---|
committer | Wierschem, Keola <[email protected]> | 2022-01-12 22:58:46 -0800 |
commit | 4d9906a94d73b07877b217d1664a991f1e25569f (patch) | |
tree | e279b88840b394b7101c0d45f4273e234633409c | |
parent | c79311a516b63a3f2b76ab12bbd6d15f13974581 (diff) | |
download | xbyak-4d9906a94d73b07877b217d1664a991f1e25569f.tar.gz xbyak-4d9906a94d73b07877b217d1664a991f1e25569f.zip |
fix condition to throw error for invalid displacements
-rw-r--r-- | xbyak/xbyak.h | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/xbyak/xbyak.h b/xbyak/xbyak.h index 637ea12..bd17021 100644 --- a/xbyak/xbyak.h +++ b/xbyak/xbyak.h @@ -1786,8 +1786,9 @@ private: { uint64_t disp64 = e.getDisp(); #ifdef XBYAK64 - uint64_t high = disp64 >> 32; - if (high != 0 && high != 0xFFFFFFFF) XBYAK_THROW(ERR_OFFSET_IS_TOO_BIG) + // displacement should be a signed 32-bit value, so also check sign bit + uint64_t high = disp64 >> 31; + if (high != 0 && high != 0x1FFFFFFFF) XBYAK_THROW(ERR_OFFSET_IS_TOO_BIG) #endif uint32_t disp = static_cast<uint32_t>(disp64); const Reg& base = e.getBase(); |