aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2013-04-26 23:38:20 +0200
committerTorbjörn Andersson2013-04-26 23:38:20 +0200
commit50c8fae6ecbc208c29c291829d367d6621b05dfa (patch)
tree1a13e097e516b2616b0b6d3f174b40748919d6b2
parent14f152997625320f0cd5cc9b92a2b1e9e6d2df00 (diff)
downloadscummvm-rg350-50c8fae6ecbc208c29c291829d367d6621b05dfa.tar.gz
scummvm-rg350-50c8fae6ecbc208c29c291829d367d6621b05dfa.tar.bz2
scummvm-rg350-50c8fae6ecbc208c29c291829d367d6621b05dfa.zip
TINSEL: Reorder loop condition to fix out-of-bounds access
This should fix CID 1003943 and CID 1003944.
-rw-r--r--engines/tinsel/dialogs.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/engines/tinsel/dialogs.cpp b/engines/tinsel/dialogs.cpp
index d0c99f7830..e6229ff3a0 100644
--- a/engines/tinsel/dialogs.cpp
+++ b/engines/tinsel/dialogs.cpp
@@ -3655,10 +3655,10 @@ extern void HideConversation(bool bHide) {
if (g_InventoryState == ACTIVE_INV && g_ino == INV_CONV) {
if (bHide) {
// Move all the window and icons off-screen
- for (i = 0; g_objArray[i] && i < MAX_WCOMP; i++) {
+ for (i = 0; i < MAX_WCOMP && g_objArray[i]; i++) {
MultiAdjustXY(g_objArray[i], 2 * SCREEN_WIDTH, 0);
}
- for (i = 0; g_iconArray[i] && i < MAX_ICONS; i++) {
+ for (i = 0; i < MAX_ICONS && g_iconArray[i]; i++) {
MultiAdjustXY(g_iconArray[i], 2 * SCREEN_WIDTH, 0);
}