From f544e95e850388d76b7dec13d287fa1a762d053e Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 3 Aug 2020 18:58:53 -0700 Subject: [PATCH] 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. --- desktop_version/src/Graphics.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index 6c1b8b95..1daabc56 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -685,13 +685,14 @@ void Graphics::drawtile2( int x, int y, int t ) void Graphics::drawtile3( int x, int y, int t, int off ) { + t += off * 30; if (!INBOUNDS(t, tiles3)) { WHINE_ONCE("drawtile3() out-of-bounds!") return; } 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)