diff options
author | Strangerke | 2016-05-24 07:30:30 +0200 |
---|---|---|
committer | Strangerke | 2016-05-24 07:46:21 +0200 |
commit | d70e3dd0d6f55685dd236c5205b1accad4352068 (patch) | |
tree | c9a7c5877c43601170850d66438ec1f3e63987cd /engines | |
parent | a923745973bfe7d0f1fba8184add7ec9c320c5e5 (diff) | |
download | scummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.tar.gz scummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.tar.bz2 scummvm-rg350-d70e3dd0d6f55685dd236c5205b1accad4352068.zip |
GNAP: Fix out of bound access in alternate font code
Diffstat (limited to 'engines')
-rw-r--r-- | engines/gnap/gamesys.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
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; |