1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-23 18:19:43 +01:00

Fix INBOUNDS() check for Graphics::drawtile3()

The function was not actually checking the number that would end up
being used to index the tiles3 vector, and as a result there could
potentially be out-of-bounds indexing. But this is fixed now.
This commit is contained in:
Misa 2020-08-03 18:58:53 -07:00 committed by Ethan Lee
parent 6704675189
commit f544e95e85

View file

@ -685,13 +685,14 @@ void Graphics::drawtile2( int x, int y, int t )
void Graphics::drawtile3( int x, int y, int t, int off ) void Graphics::drawtile3( int x, int y, int t, int off )
{ {
t += off * 30;
if (!INBOUNDS(t, tiles3)) if (!INBOUNDS(t, tiles3))
{ {
WHINE_ONCE("drawtile3() out-of-bounds!") WHINE_ONCE("drawtile3() out-of-bounds!")
return; return;
} }
SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h }; SDL_Rect rect = { Sint16(x), Sint16(y), tiles_rect.w, tiles_rect.h };
BlitSurfaceStandard(tiles3[t+(off*30)], NULL, backBuffer, &rect); BlitSurfaceStandard(tiles3[t], NULL, backBuffer, &rect);
} }
void Graphics::drawentcolours( int x, int y, int t) void Graphics::drawentcolours( int x, int y, int t)