Fix out of bound write in EfbCopy::ClearEfb
This commit is contained in:
parent
7eb02ecfa4
commit
3b8737d2d7
|
@ -3,6 +3,8 @@
|
||||||
|
|
||||||
#include "VideoBackends/Software/EfbCopy.h"
|
#include "VideoBackends/Software/EfbCopy.h"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
#include "Common/CommonTypes.h"
|
#include "Common/CommonTypes.h"
|
||||||
#include "Common/Logging/Log.h"
|
#include "Common/Logging/Log.h"
|
||||||
#include "Core/HW/Memmap.h"
|
#include "Core/HW/Memmap.h"
|
||||||
|
@ -11,6 +13,7 @@
|
||||||
|
|
||||||
#include "VideoCommon/BPMemory.h"
|
#include "VideoCommon/BPMemory.h"
|
||||||
#include "VideoCommon/Fifo.h"
|
#include "VideoCommon/Fifo.h"
|
||||||
|
#include "VideoCommon/VideoCommon.h"
|
||||||
|
|
||||||
namespace EfbCopy
|
namespace EfbCopy
|
||||||
{
|
{
|
||||||
|
@ -21,8 +24,8 @@ void ClearEfb()
|
||||||
|
|
||||||
int left = bpmem.copyTexSrcXY.x;
|
int left = bpmem.copyTexSrcXY.x;
|
||||||
int top = bpmem.copyTexSrcXY.y;
|
int top = bpmem.copyTexSrcXY.y;
|
||||||
int right = left + bpmem.copyTexSrcWH.x;
|
int right = std::min(left + bpmem.copyTexSrcWH.x, EFB_WIDTH - 1);
|
||||||
int bottom = top + bpmem.copyTexSrcWH.y;
|
int bottom = std::min(top + bpmem.copyTexSrcWH.y, EFB_HEIGHT - 1);
|
||||||
|
|
||||||
for (u16 y = top; y <= bottom; y++)
|
for (u16 y = top; y <= bottom; y++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue