diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp index cad26bbb4f..c3cb492a5f 100644 --- a/Source/Core/Common/Arm64Emitter.cpp +++ b/Source/Core/Common/Arm64Emitter.cpp @@ -1658,7 +1658,7 @@ void ARM64XEmitter::UBFM(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms) void ARM64XEmitter::BFI(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width) { u32 size = Is64Bit(Rn) ? 64 : 32; - ASSERT_MSG(DYNA_REC, (lsb + width) <= size, + ASSERT_MSG(DYNA_REC, lsb < size && width >= 1 && width <= size - lsb, "%s passed lsb %d and width %d which is greater than the register size!", __func__, lsb, width); BFM(Rd, Rn, (size - lsb) % size, width - 1); @@ -1674,7 +1674,7 @@ void ARM64XEmitter::BFXIL(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width) void ARM64XEmitter::UBFIZ(ARM64Reg Rd, ARM64Reg Rn, u32 lsb, u32 width) { u32 size = Is64Bit(Rn) ? 64 : 32; - ASSERT_MSG(DYNA_REC, (lsb + width) <= size, + ASSERT_MSG(DYNA_REC, lsb < size && width >= 1 && width <= size - lsb, "%s passed lsb %d and width %d which is greater than the register size!", __func__, lsb, width); UBFM(Rd, Rn, (size - lsb) % size, width - 1);