[Scummvm-git-logs] scummvm master -> 79003be1b3aa0b492785b3a2043b99484420a0c7

sev- sev at scummvm.org
Tue Jul 6 14:57:40 UTC 2021


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

Summary:
6e8aed5238 SAGA2: Fix potential null dereferencing. CID 1457864
827496b333 SAGA2: Fix potential NULL dereference. CID 1458002
79003be1b3 SAGA2: Fix new[]/delete mismatch


Commit: 6e8aed523879190ac8c34039173bee84a73303c2
    https://github.com/scummvm/scummvm/commit/6e8aed523879190ac8c34039173bee84a73303c2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-06T16:50:43+02:00

Commit Message:
SAGA2: Fix potential null dereferencing. CID 1457864

Changed paths:
    engines/saga2/motion.cpp


diff --git a/engines/saga2/motion.cpp b/engines/saga2/motion.cpp
index 873e37d18e..174b5b6a7f 100644
--- a/engines/saga2/motion.cpp
+++ b/engines/saga2/motion.cpp
@@ -511,7 +511,8 @@ void *MotionTask::restore(void *buf) {
 	            :   NULL;
 
 	//  If the object is an actor, plug this motion task into the actor
-	if (isActor(object))((Actor *)object)->moveTask = this;
+	if (object && isActor(object))
+		((Actor *)object)->moveTask = this;
 
 	if (motionType == motionTypeWalk
 	        ||  prevMotionType == motionTypeWalk) {


Commit: 827496b33345acb906ef02220f5a530a5084f3e3
    https://github.com/scummvm/scummvm/commit/827496b33345acb906ef02220f5a530a5084f3e3
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-06T16:55:12+02:00

Commit Message:
SAGA2: Fix potential NULL dereference. CID 1458002

Changed paths:
    engines/saga2/actor.cpp


diff --git a/engines/saga2/actor.cpp b/engines/saga2/actor.cpp
index 368ffc7dd1..d24608bdf3 100644
--- a/engines/saga2/actor.cpp
+++ b/engines/saga2/actor.cpp
@@ -1169,10 +1169,9 @@ Actor::Actor(const ResourceActor &res) : GameObject(res) {
 	deactivationCounter = 0;
 	_assignment = nullptr;
 
-	memcpy(
-	    &effectiveStats,
-	    &((ActorProto *)prototype)->baseStats,
-	    sizeof(effectiveStats));
+	if (prototype)
+		memcpy(&effectiveStats, &((ActorProto *)prototype)->baseStats, sizeof(effectiveStats));
+
 	effectiveStats.vitality = MAX<uint16>(effectiveStats.vitality, 1);
 
 	actionCounter       = 0;


Commit: 79003be1b3aa0b492785b3a2043b99484420a0c7
    https://github.com/scummvm/scummvm/commit/79003be1b3aa0b492785b3a2043b99484420a0c7
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-07-06T16:56:37+02:00

Commit Message:
SAGA2: Fix new[]/delete mismatch

Changed paths:
    engines/saga2/sagafunc.cpp


diff --git a/engines/saga2/sagafunc.cpp b/engines/saga2/sagafunc.cpp
index 2950276bb9..e6865bf8c3 100644
--- a/engines/saga2/sagafunc.cpp
+++ b/engines/saga2/sagafunc.cpp
@@ -3678,8 +3678,8 @@ int16 scriptSwapRegions(int16 *args) {
 		obj->move(loc);
 	}
 
-	delete objArray1;
-	delete objArray2;
+	delete[] objArray1;
+	delete[] objArray2;
 
 	return 0;
 }




More information about the Scummvm-git-logs mailing list