From d70e3dd0d6f55685dd236c5205b1accad4352068 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Tue, 24 May 2016 07:30:30 +0200 Subject: GNAP: Fix out of bound access in alternate font code --- engines/gnap/gamesys.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'engines') diff --git a/engines/gnap/gamesys.cpp b/engines/gnap/gamesys.cpp index 8fcf1dca58..80cf68943f 100644 --- a/engines/gnap/gamesys.cpp +++ b/engines/gnap/gamesys.cpp @@ -287,7 +287,7 @@ void GameSys::drawTextToSurface(Graphics::Surface *surface, int x, int y, byte r } else { for (const char *cp = text; *cp != 0; ++cp) { byte c = *cp; - if (c < 32 || c > 127) + if (c < 32 || c >= 127) c = (byte)'_'; c -= 32; int w = _dejaVuSans9ptCharDescriptors[c]._width; @@ -312,7 +312,7 @@ int GameSys::getTextHeight(const char *text) { byte height = 0; for (const char *cp = text; *cp != 0; ++cp) { byte c = *cp; - if (c < 32 || c > 127) + if (c < 32 || c >= 127) c = (byte)'_'; c -= 32; height = MAX(height, _dejaVuSans9ptCharDescriptors[c]._width); @@ -324,7 +324,7 @@ int GameSys::getTextWidth(const char *text) { int width = 0; for (const char *cp = text; *cp != 0; ++cp) { byte c = *cp; - if (c < 32 || c > 127) + if (c < 32 || c >= 127) c = (byte)'_'; c -= 32; width += _dejaVuSans9ptCharDescriptors[c]._width + 1; -- cgit v1.2.3