From 71c8ad605f1dbf3880ec0ca5917a201054bb31ac Mon Sep 17 00:00:00 2001 From: refractionpcsx2 Date: Wed, 14 Feb 2024 10:00:28 +0000 Subject: [PATCH] RAchievements: Fix off by one error in scratchpad reads --- pcsx2/Achievements.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pcsx2/Achievements.cpp b/pcsx2/Achievements.cpp index 8063c4d625eaf..e18162a1fd7f4 100644 --- a/pcsx2/Achievements.cpp +++ b/pcsx2/Achievements.cpp @@ -599,7 +599,7 @@ void Achievements::ClientMessageCallback(const char* message, const rc_client_t* uint32_t Achievements::ClientReadMemory(uint32_t address, uint8_t* buffer, uint32_t num_bytes, rc_client_t* client) { - if ((static_cast(address) + num_bytes) >= EXPOSED_EE_MEMORY_SIZE) [[unlikely]] + if ((static_cast(address) + num_bytes) > EXPOSED_EE_MEMORY_SIZE) [[unlikely]] { DevCon.Warning("[Achievements] Ignoring out of bounds memory peek of %u bytes at %08X.", num_bytes, address); return 0u; @@ -3097,7 +3097,7 @@ void Achievements::RAIntegration::RACallbackLoadROM(const char* unused) unsigned char Achievements::RAIntegration::RACallbackReadMemory(unsigned int address) { - if ((static_cast(address) + sizeof(unsigned char)) >= EXPOSED_EE_MEMORY_SIZE) + if ((static_cast(address) + sizeof(unsigned char)) > EXPOSED_EE_MEMORY_SIZE) { DevCon.Warning("[Achievements] Ignoring out of bounds memory peek at %08X.", address); return 0u; @@ -3134,7 +3134,7 @@ unsigned int Achievements::RAIntegration::RACallbackReadBlock(unsigned int addre void Achievements::RAIntegration::RACallbackWriteMemory(unsigned int address, unsigned char value) { - if ((static_cast(address) + sizeof(value)) >= EXPOSED_EE_MEMORY_SIZE) [[unlikely]] + if ((static_cast(address) + sizeof(value)) > EXPOSED_EE_MEMORY_SIZE) [[unlikely]] { DevCon.Warning("[Achievements] Ignoring out of bounds memory poke at %08X (value %08X).", address, value); return;