From 140861a79d372b66c1354a78cf4224a4409c7205 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 9 Sep 2020 22:35:35 -0700 Subject: [PATCH] Add bounds checks to both versions of Graphics::drawsprite() For some reason, I forgot to add bounds checks to these functions. Well, I'm glad I caught it, anyways. --- desktop_version/src/Graphics.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/desktop_version/src/Graphics.cpp b/desktop_version/src/Graphics.cpp index e1c1f41c..1c4d3b67 100644 --- a/desktop_version/src/Graphics.cpp +++ b/desktop_version/src/Graphics.cpp @@ -622,6 +622,11 @@ void Graphics::printcrewnamestatus( int x, int y, int t ) void Graphics::drawsprite( int x, int y, int t, int r, int g, int b ) { + if (!INBOUNDS_VEC(t, sprites)) + { + WHINE_ONCE("drawsprite() out-of-bounds!"); + } + SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h }; setcolreal(getRGB(r,g,b)); BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct); @@ -629,6 +634,11 @@ void Graphics::drawsprite( int x, int y, int t, int r, int g, int b ) void Graphics::drawsprite(int x, int y, int t, Uint32 c) { + if (!INBOUNDS_VEC(t, sprites)) + { + WHINE_ONCE("drawsprite() out-of-bounds!"); + } + SDL_Rect rect = { Sint16(x), Sint16(y), sprites_rect.w, sprites_rect.h }; setcolreal(c); BlitSurfaceColoured(sprites[t], NULL, backBuffer, &rect, ct);