From c6352a262d272468e867138f3d3310234302210b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Tue, 28 Feb 2023 23:21:36 +0100 Subject: [PATCH] Fix crash in SoftGPU when frameskipping, noticed by sum2012 in Daxter Fixes #17021 --- GPU/Software/SoftGpu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/GPU/Software/SoftGpu.cpp b/GPU/Software/SoftGpu.cpp index 2a3bf685f749..7fe082b859b7 100644 --- a/GPU/Software/SoftGpu.cpp +++ b/GPU/Software/SoftGpu.cpp @@ -670,6 +670,9 @@ void SoftGPU::MarkDirty(uint32_t addr, uint32_t bytes, SoftGPUVRAMDirty value) { uint32_t start = ((addr - PSP_GetVidMemBase()) & 0x001FFFFF) >> 10; uint32_t end = start + ((bytes + 1023) >> 10); + if (end > sizeof(vramDirty_)) { + end = sizeof(vramDirty_); + } if (value == SoftGPUVRAMDirty::CLEAR || value == (SoftGPUVRAMDirty::DIRTY | SoftGPUVRAMDirty::REALLY_DIRTY)) { memset(vramDirty_ + start, (uint8_t)value, end - start); } else {