diff --git a/rpcs3/Emu/Cell/SPURecompiler.cpp b/rpcs3/Emu/Cell/SPURecompiler.cpp index a3a35d5535..fd213b1247 100644 --- a/rpcs3/Emu/Cell/SPURecompiler.cpp +++ b/rpcs3/Emu/Cell/SPURecompiler.cpp @@ -588,9 +588,12 @@ std::deque spu_cache::get() break; } - func.resize(size); + if (utils::add_saturate(addr, utils::mul_saturate(size, 4)) > SPU_LS_SIZE) + { + break; + } - if (m_file.read(func.data(), func.size() * 4) != func.size() * 4) + if (!m_file.read(func, size)) { break; }