GPU/D3D11: Fix possible buffer overwrite when reading back

This commit is contained in:
Connor McLaughlin
2021-07-04 21:40:44 +10:00
parent 8be2b66ebb
commit 6e9ebfa5b5
2 changed files with 4 additions and 4 deletions

View File

@ -55,7 +55,7 @@ public:
{
const u8* src_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
u8* dst_ptr = reinterpret_cast<u8*>(data);
if (m_map.RowPitch != stride)
if (m_map.RowPitch != stride || width != m_width || x != 0)
{
for (u32 row = 0; row < height; row++)
{
@ -89,7 +89,7 @@ public:
{
const u8* src_ptr = reinterpret_cast<const u8*>(data);
u8* dst_ptr = static_cast<u8*>(m_map.pData) + (y * m_map.RowPitch) + (x * sizeof(T));
if (m_map.RowPitch != stride)
if (m_map.RowPitch != stride || width != m_width || x != 0)
{
for (u32 row = 0; row < height; row++)
{