Navigation Menu

Skip to content

Commit

Permalink
- fix out of bounds crash
Browse files Browse the repository at this point in the history
  • Loading branch information
dpjudas committed Aug 6, 2019
1 parent eb127d0 commit b34658d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rendering/polyrenderer/drawers/screen_triangle.cpp
Expand Up @@ -227,8 +227,8 @@ static float wrap(float value)

static uint32_t sampleTexture(float u, float v, const uint32_t* texPixels, int texWidth, int texHeight)
{
int texelX = static_cast<int>(wrap(u) * texWidth);
int texelY = static_cast<int>(wrap(v) * texHeight);
int texelX = MIN(static_cast<int>(wrap(u) * texWidth), texWidth - 1);
int texelY = MIN(static_cast<int>(wrap(v) * texHeight), texHeight - 1);
return texPixels[texelX * texHeight + texelY];
}

Expand Down Expand Up @@ -257,10 +257,10 @@ static void RunShader(int x0, int x1, PolyTriangleThreadData* thread)
}
else if (thread->SpecialEffect == EFF_STENCIL) // stencil.fp
{
for (int x = x0; x < x1; x++)
/*for (int x = x0; x < x1; x++)
{
fragcolor[x] = 0x00ffffff;
}
}*/
return;
}
else if (thread->EffectState == SHADER_NoTexture) // func_notexture
Expand Down

0 comments on commit b34658d

Please sign in to comment.