aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2012-11-06 01:30:33 +0200
committerFilippos Karapetis2012-11-06 01:30:33 +0200
commitbdb8bdae2a206e736278321d599ed2d1e3ae8b76 (patch)
treebee5b0918e30f1c10d8ba77d34d79dbe9bdb6122
parent3b7224f0526704165d7109bf8cba901435d5d099 (diff)
downloadscummvm-rg350-bdb8bdae2a206e736278321d599ed2d1e3ae8b76.tar.gz
scummvm-rg350-bdb8bdae2a206e736278321d599ed2d1e3ae8b76.tar.bz2
scummvm-rg350-bdb8bdae2a206e736278321d599ed2d1e3ae8b76.zip
DREAMWEB: Filter out leftover invalid characters in game texts
Thanks to eriktorbjorn for spotting the actual problem
-rw-r--r--engines/dreamweb/print.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/engines/dreamweb/print.cpp b/engines/dreamweb/print.cpp
index 64b9849980..f5a0ed3c15 100644
--- a/engines/dreamweb/print.cpp
+++ b/engines/dreamweb/print.cpp
@@ -59,9 +59,13 @@ uint8 DreamWebEngine::getNextWord(const GraphicsFile &charSet, const uint8 *stri
}
void DreamWebEngine::printChar(const GraphicsFile &charSet, uint16* x, uint16 y, uint8 c, uint8 nextChar, uint8 *width, uint8 *height) {
- if (c == 255)
+ // WORKAROUND: Some texts contain leftover tab characters, which will cause
+ // OOB memory access when showing a character, as all the printable ones are
+ // from 32 onwards. We compensate for that here by ignoring all the invalid
+ // characters (0 - 31).
+ if (c < 32 || c == 255)
return;
-
+
uint8 dummyWidth, dummyHeight;
if (width == NULL)
width = &dummyWidth;