aboutsummaryrefslogtreecommitdiff
path: root/engines/sci
diff options
context:
space:
mode:
authormd52011-05-27 02:31:03 +0300
committermd52011-05-27 02:32:22 +0300
commita010884c9bfb230da1448d2598011dc68e9efb22 (patch)
treeea86116c003a7850ef3e74e15e3b3a3237c73804 /engines/sci
parent09ba2ad438d1316792861b25e68e19594eb26c7f (diff)
downloadscummvm-rg350-a010884c9bfb230da1448d2598011dc68e9efb22.tar.gz
scummvm-rg350-a010884c9bfb230da1448d2598011dc68e9efb22.tar.bz2
scummvm-rg350-a010884c9bfb230da1448d2598011dc68e9efb22.zip
SCI: Fixed bug #3306417 - "LAURA BOW 2: segmentation fault while talking to Dr. Myklos"
Diffstat (limited to 'engines/sci')
-rw-r--r--engines/sci/engine/kstring.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/engines/sci/engine/kstring.cpp b/engines/sci/engine/kstring.cpp
index c3f2b4dee2..add5b7b52d 100644
--- a/engines/sci/engine/kstring.cpp
+++ b/engines/sci/engine/kstring.cpp
@@ -66,8 +66,24 @@ reg_t kStrCpy(EngineState *s, int argc, reg_t *argv) {
s->_segMan->strncpy(argv[0], argv[1], length);
else
s->_segMan->memcpy(argv[0], argv[1], -length);
- } else
+ } else {
+ if (g_sci->getGameId() == GID_LAURABOW2 && g_sci->getLanguage() == Common::DE_DEU &&
+ s->currentRoomNumber() == 360) {
+ // One of the game texts in LB2 German contains loads of spaces in
+ // its end. We trim the text here, otherwise the graphics code will
+ // attempt to draw a very large window (larger than the screen) to
+ // show the text, and crash.
+ // Fixes bug #3306417.
+ SegmentRef src = s->_segMan->dereference(argv[1]);
+ if (src.maxSize == 7992) { // the problematic resource. Trim it.
+ Common::String text = s->_segMan->getString(argv[1]);
+ text.trim();
+ s->_segMan->strcpy(argv[1], text.c_str());
+ }
+ }
+
s->_segMan->strcpy(argv[0], argv[1]);
+ }
return argv[0];
}