gsdx sw: init completely m_scanline buffer

The buffer contains extra room to avoid a segmentation fault due to an overflow.
Unfortunately the end of the buffer wasn't initialized which can lead to unexpected behavior.

Based on issue #1806 it could impact Guilty Gear X2
This commit is contained in:
Gregory Hainaut 2017-02-08 19:30:53 +01:00
parent 2a2a022792
commit 213fa1c148
1 changed files with 6 additions and 4 deletions

View File

@ -52,11 +52,12 @@ GSRasterizer::GSRasterizer(IDrawScanline* ds, int id, int threads, GSPerfMon* pe
m_edge.buff = (GSVertexSW*)vmalloc(sizeof(GSVertexSW) * 2048, false);
m_edge.count = 0;
m_scanline = (uint8*)_aligned_malloc((2048 >> m_thread_height) + 16, 64);
int rows = (2048 >> m_thread_height) + 16;
m_scanline = (uint8*)_aligned_malloc(rows, 64);
int row = 0;
while(row < (2048 >> m_thread_height))
while(row < rows)
{
for(int i = 0; i < threads; i++, row++)
{
@ -1143,11 +1144,12 @@ GSRasterizerList::GSRasterizerList(int threads, GSPerfMon* perfmon)
{
m_thread_height = compute_best_thread_height(threads);
m_scanline = (uint8*)_aligned_malloc((2048 >> m_thread_height) + 16, 64);
int rows = (2048 >> m_thread_height) + 16;
m_scanline = (uint8*)_aligned_malloc(rows, 64);
int row = 0;
while(row < (2048 >> m_thread_height))
while(row < rows)
{
for(int i = 0; i < threads; i++, row++)
{