fix potential out-of-bounds write

This commit is contained in:
Arisotura 2019-07-13 02:54:14 +02:00
parent ff27036b35
commit 22f3cae067
2 changed files with 4 additions and 1 deletions

View File

@ -284,6 +284,7 @@ void SetDisplaySettings(bool accel)
if (Framebuffer[1][0]) delete[] Framebuffer[1][0];
if (Framebuffer[0][1]) delete[] Framebuffer[0][1];
if (Framebuffer[1][1]) delete[] Framebuffer[1][1];
Framebuffer[0][0] = new u32[fbsize];
Framebuffer[1][0] = new u32[fbsize];
Framebuffer[0][1] = new u32[fbsize];

View File

@ -753,8 +753,10 @@ void GPU2D::DrawScanline(u32 line)
case 1: // regular display
{
for (int i = 0; i < stride; i+=2)
int i = 0;
for (; i < (stride & ~1); i+=2)
*(u64*)&dst[i] = *(u64*)&BGOBJLine[i];
if (stride & 1) dst[i] = BGOBJLine[i];
}
break;