diff options
| author | Admiral H. Curtiss <pikachu025@gmail.com> | 2023-12-09 02:26:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-12-09 02:26:15 +0100 |
| commit | 515bd101084af9c5046b79cd727fe04a552939c6 (patch) | |
| tree | 5720dde1614cd8fbf02d3e76fe046ac64af736ad /Source/Core/VideoBackends/Software/EfbCopy.cpp | |
| parent | 7eb02ecfa452578d9596501cc097d26b80a15931 (diff) | |
| parent | 3b8737d2d7172ae62ae9135e4c9942dde1f47d13 (diff) | |
Merge pull request #12365 from timetravelthree/master
Fix out of bound write in EfbCopy::ClearEfb
Diffstat (limited to 'Source/Core/VideoBackends/Software/EfbCopy.cpp')
| -rw-r--r-- | Source/Core/VideoBackends/Software/EfbCopy.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Source/Core/VideoBackends/Software/EfbCopy.cpp b/Source/Core/VideoBackends/Software/EfbCopy.cpp index c23ca5622c..15a3fb3a02 100644 --- a/Source/Core/VideoBackends/Software/EfbCopy.cpp +++ b/Source/Core/VideoBackends/Software/EfbCopy.cpp @@ -3,6 +3,8 @@ #include "VideoBackends/Software/EfbCopy.h" +#include <algorithm> + #include "Common/CommonTypes.h" #include "Common/Logging/Log.h" #include "Core/HW/Memmap.h" @@ -11,6 +13,7 @@ #include "VideoCommon/BPMemory.h" #include "VideoCommon/Fifo.h" +#include "VideoCommon/VideoCommon.h" namespace EfbCopy { @@ -21,8 +24,8 @@ void ClearEfb() int left = bpmem.copyTexSrcXY.x; int top = bpmem.copyTexSrcXY.y; - int right = left + bpmem.copyTexSrcWH.x; - int bottom = top + bpmem.copyTexSrcWH.y; + int right = std::min(left + bpmem.copyTexSrcWH.x, EFB_WIDTH - 1); + int bottom = std::min(top + bpmem.copyTexSrcWH.y, EFB_HEIGHT - 1); for (u16 y = top; y <= bottom; y++) { |
