Add a bounds check to writeVideoImageWithRange().

Fixes crash in Jeanne d' Arc, which sends 480x480.
This commit is contained in:
Unknown W. Brackets 2013-06-02 11:40:12 -07:00
parent 3468d7ddd9
commit 3d5f818095

View File

@ -447,6 +447,11 @@ bool MediaEngine::writeVideoImageWithRange(u8* buffer, int frameWidth, int video
u16 *imgbuf16 = (u16 *)buffer;
u16 *data16 = (u16 *)data;
if (width > m_desWidth - xpos)
width = m_desWidth - xpos;
if (height > m_desHeight - ypos)
height = m_desHeight - ypos;
switch (videoPixelMode) {
case TPSM_PIXEL_STORAGE_MODE_32BIT_ABGR8888:
data += (ypos * m_desWidth + xpos) * sizeof(u32);