[Scummvm-git-logs] scummvm master -> 1e593a4e69051d615a7f5810c416837c69cd1b50

bgK bastien.bouclet at gmail.com
Sun Nov 26 08:55:18 CET 2017


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0bd2e53cd4 FULLPIPE: Fix handleInteraction for non static ani objects
1e593a4e69 FULLPIPE: Fix out of bounds string access


Commit: 0bd2e53cd49f21f3db4b6c8b762033ce1320172f
    https://github.com/scummvm/scummvm/commit/0bd2e53cd49f21f3db4b6c8b762033ce1320172f
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-11-26T08:51:36+01:00

Commit Message:
FULLPIPE: Fix handleInteraction for non static ani objects

cce851d1af introduced a check to allow only static ani objects. However
after this change, only part of the pipes for vertical movement were
interactive.
This change aims to restore functionality for the other object types
while still preventing the invalid casts.

Changed paths:
    engines/fullpipe/interaction.cpp
    engines/fullpipe/statics.cpp


diff --git a/engines/fullpipe/interaction.cpp b/engines/fullpipe/interaction.cpp
index 08c8c8f..38ca73b 100644
--- a/engines/fullpipe/interaction.cpp
+++ b/engines/fullpipe/interaction.cpp
@@ -168,50 +168,51 @@ bool InteractionController::handleInteraction(StaticANIObject *subj, GameObject
 		return false;
 
 	if (!inter->_objectId2) {
-		if (obj->_objtype != kObjTypeStaticANIObject)
-			return false;
-
-		StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
-
-		if (!ani->isIdle())
-			return false;
+		if (obj->_objtype == kObjTypeStaticANIObject) {
+			StaticANIObject *ani = static_cast<StaticANIObject *>(obj);
 
-		if (ani->_flags & 0x100)
-			return false;
+			if (inter->_flags & 1) {
+				if (!ani->isIdle())
+					return false;
 
-		if (!inter->_staticsId1 || !(inter->_flags & 1))
-			goto LABEL_38;
+				if (ani->_flags & 0x100)
+					return false;
+			} else if (inter->_staticsId1 != 0) {
+				if (ani->_movement || ani->_statics == 0 || ani->_statics->_staticsId != inter->_staticsId1) {
+					mq = ani->changeStatics1(inter->_staticsId1);
+					if (!mq)
+						return false;
 
-		if (ani->_movement || ani->_statics == 0 || ani->_statics->_staticsId != inter->_staticsId1) {
-			mq = ani->changeStatics1(inter->_staticsId1);
-			if (!mq)
-				return false;
+					ex = new ExCommand((subj ? subj->_id : 0), 55, 0, 0, 0, 0, 1, 0, 0, 0);
+					ex->_x = obj->_id;
+					ex->_y = obj->_odelay;
+					ex->_param = subj ? subj->_odelay : 0;
+					ex->_excFlags = 3;
+					ex->_field_14 = (obj->_objtype != kObjTypePictureObject);
+					ex->_field_20 = invId;
+					mq->addExCommandToEnd(ex);
 
-			ex = new ExCommand((subj ? subj->_id : 0), 55, 0, 0, 0, 0, 1, 0, 0, 0);
-			ex->_x = obj->_id;
-			ex->_y = obj->_odelay;
-			ex->_param = subj ? subj->_odelay : 0;
-			ex->_excFlags = 3;
-			ex->_field_14 = (obj->_objtype != kObjTypePictureObject);
-			ex->_field_20 = invId;
-			mq->addExCommandToEnd(ex);
+					if (mq->_isFinished) {
+						mq->_isFinished = 0;
+						ani->queueMessageQueue(mq);
+					}
 
-			if (mq->_isFinished) {
-				mq->_isFinished = 0;
-				ani->queueMessageQueue(mq);
+					return true;
+				} else {
+					if (ani->getMessageQueue())
+						ani->queueMessageQueue(0);
+				}
 			}
-		} else {
-			if (ani->getMessageQueue())
-				ani->queueMessageQueue(0);
-LABEL_38:
-			if (inter->_messageQueue) {
-				mq = new MessageQueue(inter->_messageQueue, 0, 1);
-				mq->changeParam28ForObjectId(ani->_id, -1, ani->_odelay);
+		}
 
-				if (!mq->chain(0))
-					return false;
-			}
+		if (inter->_messageQueue) {
+			mq = new MessageQueue(inter->_messageQueue, 0, 1);
+			mq->changeParam28ForObjectId(obj->_id, -1, obj->_odelay);
+
+			if (!mq->chain(0))
+				return false;
 		}
+
 		return true;
 	}
 
diff --git a/engines/fullpipe/statics.cpp b/engines/fullpipe/statics.cpp
index 524eeff..a1252a7 100644
--- a/engines/fullpipe/statics.cpp
+++ b/engines/fullpipe/statics.cpp
@@ -348,8 +348,7 @@ void StaticANIObject::startMQIfIdle(int qId, int flag) {
 }
 
 bool StaticANIObject::isIdle() {
-	if (_objtype != kObjTypeStaticANIObject)
-		return true;
+	assert(_objtype == kObjTypeStaticANIObject);
 
 	if (_messageQueueId) {
 		MessageQueue *m = g_fp->_globalMessageQueueList->getMessageQueueById(_messageQueueId);


Commit: 1e593a4e69051d615a7f5810c416837c69cd1b50
    https://github.com/scummvm/scummvm/commit/1e593a4e69051d615a7f5810c416837c69cd1b50
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-11-26T08:51:36+01:00

Commit Message:
FULLPIPE: Fix out of bounds string access

abe1c65d626a8f3 changed _trackName from a char * to a Common::String,
but still tried to access the null terminator byte.

Changed paths:
    engines/fullpipe/sound.cpp


diff --git a/engines/fullpipe/sound.cpp b/engines/fullpipe/sound.cpp
index b1d0a26..31e3580 100644
--- a/engines/fullpipe/sound.cpp
+++ b/engines/fullpipe/sound.cpp
@@ -332,7 +332,7 @@ int FullpipeEngine::getSceneTrack() {
 
 		int track = num + 1;
 
-		if (!_trackName[num + 2])
+		if (num + 2 >= (int)_trackName.size())
 			track = 0;
 
 		_musicGameVar->setSubVarAsInt("TRACKS", track);





More information about the Scummvm-git-logs mailing list