Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix underflow in IndexGenerator::AddFan
fix issue 6282

The Last Story seems to render a fan with two vertices. It is non-sense as it
shouldn't do anything, but the code underflows at (u32)numVerts-3
  • Loading branch information
degasus committed May 9, 2013
1 parent a031351 commit c748660
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Source/Core/VideoCommon/Src/IndexGenerator.cpp
Expand Up @@ -142,7 +142,7 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)

if(pr)
{
for(; i<=numVerts-3; i+=3)
for(; i+3<=numVerts; i+=3)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;
Expand All @@ -153,7 +153,7 @@ template <bool pr> void IndexGenerator::AddFan(u32 numVerts)
numT += 3;
}

for(; i<=numVerts-2; i+=2)
for(; i+2<=numVerts; i+=2)
{
*Tptr++ = index + i - 1;
*Tptr++ = index + i + 0;
Expand Down

0 comments on commit c748660

Please sign in to comment.