aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2016-11-06 10:48:22 +0100
committerTorbjörn Andersson2016-11-06 10:48:22 +0100
commit58a32cddecc176a4b0e4709fa2ef98a3cd9c0887 (patch)
tree98c6bdd3fb49e3b139c177abb946a75902edc9aa
parent3b1bb73357c2834f547f08fe92727ca4aae22e4d (diff)
downloadscummvm-rg350-58a32cddecc176a4b0e4709fa2ef98a3cd9c0887.tar.gz
scummvm-rg350-58a32cddecc176a4b0e4709fa2ef98a3cd9c0887.tar.bz2
scummvm-rg350-58a32cddecc176a4b0e4709fa2ef98a3cd9c0887.zip
ADL - Fix overflow causing infinite loop in word-wrapping (bug #9628)
When the text to word-wrap was longer than 255 characters, the 'pos' and 'endPos' counters would overflow, causing it to never reach the end of the string to word-wrap.
-rw-r--r--engines/adl/adl_v2.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/adl/adl_v2.cpp b/engines/adl/adl_v2.cpp
index 979d794146..454e4acc78 100644
--- a/engines/adl/adl_v2.cpp
+++ b/engines/adl/adl_v2.cpp
@@ -182,8 +182,8 @@ Common::String AdlEngine_v2::loadMessage(uint idx) const {
void AdlEngine_v2::printString(const Common::String &str) {
Common::String s(str);
- byte endPos = TEXT_WIDTH - 1;
- byte pos = 0;
+ int endPos = TEXT_WIDTH - 1;
+ int pos = 0;
while (true) {
while (pos <= endPos && pos != s.size()) {