aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRSDuck <RSDuck@users.noreply.github.com>2021-05-24 19:41:24 +0200
committerRSDuck <RSDuck@users.noreply.github.com>2021-05-24 19:41:24 +0200
commit9181ab19c703890db7f12a2f7f42fc6b1c99d0e8 (patch)
treea524addc0d9dfee5913441a774898779b8534159 /src
parentf271bdf325835813e2abfd08f4a850be9807b8c4 (diff)
GPU3D soft: prevent out of bounds read
Diffstat (limited to 'src')
-rw-r--r--src/GPU3D_Soft.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/GPU3D_Soft.cpp b/src/GPU3D_Soft.cpp
index 8aebf7c..a1cf1a2 100644
--- a/src/GPU3D_Soft.cpp
+++ b/src/GPU3D_Soft.cpp
@@ -1066,7 +1066,7 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y)
// against the pixel underneath
if (!fnDepthTest(DepthBuffer[pixeladdr], z, dstattr))
{
- if (!(dstattr & 0x3)) continue;
+ if (!(dstattr & 0x3) || pixeladdr >= BufferSize) continue;
pixeladdr += BufferSize;
dstattr = AttrBuffer[pixeladdr];
@@ -1162,7 +1162,7 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y)
// against the pixel underneath
if (!fnDepthTest(DepthBuffer[pixeladdr], z, dstattr))
{
- if (!(dstattr & 0x3)) continue;
+ if (!(dstattr & 0x3) || pixeladdr >= BufferSize) continue;
pixeladdr += BufferSize;
dstattr = AttrBuffer[pixeladdr];
@@ -1237,7 +1237,7 @@ void SoftRenderer::RenderPolygonScanline(RendererPolygon* rp, s32 y)
// against the pixel underneath
if (!fnDepthTest(DepthBuffer[pixeladdr], z, dstattr))
{
- if (!(dstattr & 0x3)) continue;
+ if (!(dstattr & 0x3) || pixeladdr >= BufferSize) continue;
pixeladdr += BufferSize;
dstattr = AttrBuffer[pixeladdr];