Skip to content

Commit

Permalink
Reject zero-vertex-count draws.
Browse files Browse the repository at this point in the history
I thought all the code was safe against it, but it isn't.
  • Loading branch information
hrydgard committed Dec 29, 2023
1 parent 5b0e821 commit f22249c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions GPU/Common/DrawEngineCommon.cpp
Expand Up @@ -910,6 +910,10 @@ bool DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti
if ((vertexCount < 2 && prim > 0) || (prim > GE_PRIM_LINE_STRIP && prim != GE_PRIM_RECTANGLES)) {
return false;
}
if (vertexCount <= 0) {
// Unfortunately we need to do this check somewhere since GetIndexBounds doesn't handle zero-length arrays.
return false;
}
}

bool applySkin = (vertTypeID & GE_VTYPE_WEIGHT_MASK) && decOptions_.applySkinInDecode;
Expand Down

0 comments on commit f22249c

Please sign in to comment.