GS/HW: Prevent out of bounds copy in OI_BlitFMV()

This commit is contained in:
Stenzek 2023-02-24 22:32:49 +10:00 committed by refractionpcsx2
parent 1eaec773e2
commit 520a369872
3 changed files with 5 additions and 1 deletions

View File

@ -88,6 +88,7 @@ public:
int GetWidth() const { return m_size.x; }
int GetHeight() const { return m_size.y; }
GSVector2i GetSize() const { return m_size; }
GSVector4i GetRect() const { return GSVector4i(m_size).zwxy(); }
int GetMipmapLevels() const { return m_mipmap_levels; }
bool IsMipmap() const { return m_mipmap_levels > 1; }

View File

@ -4560,7 +4560,7 @@ bool GSRendererHW::OI_BlitFMV(GSTextureCache::Target* _rt, GSTextureCache::Sourc
// Copy back the texture into the GS mem. I don't know why but it will be
// reuploaded again later
m_tc->Read(tex, r_texture);
m_tc->Read(tex, r_texture.rintersect(tex->m_texture->GetRect()));
m_tc->InvalidateVideoMemSubTarget(_rt);

View File

@ -2830,6 +2830,9 @@ void GSTextureCache::Read(Target* t, const GSVector4i& r)
void GSTextureCache::Read(Source* t, const GSVector4i& r)
{
if (r.rempty())
return;
const GSVector4i drc(0, 0, r.width(), r.height());
if (!PrepareDownloadTexture(drc.z, drc.w, GSTexture::Format::Color, &m_color_download_texture))