DS GX: Fix another polygon overflow
Vicki Pfau vi@endrift.com
Wed, 29 Jul 2020 18:58:10 -0700
1 files changed,
6 insertions(+),
0 deletions(-)
jump to
M
src/ds/gx.c
→
src/ds/gx.c
@@ -322,6 +322,7 @@ }
return true; } + // Clip planes struct DSGXVertex inList[10]; struct DSGXVertex outList[10]; int outOffscreenVerts[10] = { 0, 0, 0, 0 };@@ -340,6 +341,7 @@ mLOG(DS_GX, ERROR, "Polygon clipping invariant failed");
return false; } if (!(offscreenVerts[v] & (1 << plane))) { + // This vertex doesn't need clipping outList[newV] = inList[v]; outOffscreenVerts[newV] = offscreenVerts[v]; ++newV;@@ -369,6 +371,10 @@ } else {
iv = 0; } if (!(offscreenVerts[iv] & (1 << plane))) { + if (newV >= 10) { + mLOG(DS_GX, ERROR, "Polygon clipping invariant failed"); + return false; + } in2 = &inList[iv]; out = &outList[newV]; if (_lerpVertexP(in, in2, out, plane >> 1, -1 + (plane & 1) * 2)) {