[Scummvm-git-logs] scummvm master -> dbe6368d91a9aefce3395cb4720189be99ebec72

npjg noreply at scummvm.org
Sat Jul 25 23:30:46 UTC 2026


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

Summary:
cb1275e517 MEDIASTATION: Address division-by-zero defects
ee2f0f8ced MEDIASTATION: Fix possible null dereference. PVS-Studio V519, V1004. CID 1658132
f813333003 MEDIASTATION: Fix arguments in wrong order defect (CID 1641367)
b167146885 MEDIASTATION: Fix useless call defect (CID 1645435)
570499815d MEDIASTATION: Fix unused value defect (CID 1664000)
738a9eb96f MEDIASTATION: Remove unused field. PVS-Studio V703
6f9bd3816b MEDIASTATION: Fix virtual call in constructor. PVS-Studio V1053
49eaaefa5f MEDIASTATION: Remove redundant nullptr checks. PVS-Studio V547
9360680cab MEDIASTATION: Initialize uninitialized members. PVS-Studio V730
dbe6368d91 MEDIASTATION: Fix potential confusion on lookalike variable names. PVS-Studio V1051


Commit: cb1275e5174b0655e16d30ebae3ab7169f9a8190
    https://github.com/scummvm/scummvm/commit/cb1275e5174b0655e16d30ebae3ab7169f9a8190
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Address division-by-zero defects

CID 1643976
CID 1643980

Changed paths:
    engines/mediastation/actors/camera.cpp


diff --git a/engines/mediastation/actors/camera.cpp b/engines/mediastation/actors/camera.cpp
index da579dd6f96..68d5f9f147d 100644
--- a/engines/mediastation/actors/camera.cpp
+++ b/engines/mediastation/actors/camera.cpp
@@ -466,6 +466,9 @@ void CameraActor::setXYDelta() {
 }
 
 void CameraActor::panToByTime(int16 x, int16 y, double duration) {
+	if (duration == 0) {
+		error("%s: Pan duration can't be zero", __func__);
+	}
 	_panState = kCameraPanToByTime;
 	_panStart = _currentViewportOrigin;
 	_panDest = Common::Point(x, y);
@@ -481,6 +484,12 @@ void CameraActor::panToByTime(int16 x, int16 y, double duration) {
 }
 
 void CameraActor::panToByStepCount(int16 x, int16 y, uint panSteps, double duration) {
+	if (duration == 0) {
+		error("%s: Pan duration can't be zero", __func__);
+	}
+	if (panSteps == 0) {
+		error("%s: Pan steps can't be zero", __func__);
+	}
 	_panState = kCameraPanByStepCount;
 	_panStart = _currentViewportOrigin;
 	_panDest = Common::Point(x, y);


Commit: ee2f0f8cedc8d669f454863c6788494a5bd0a22d
    https://github.com/scummvm/scummvm/commit/ee2f0f8cedc8d669f454863c6788494a5bd0a22d
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix possible null dereference. PVS-Studio V519, V1004. CID 1658132

Changed paths:
    engines/mediastation/actors/timer.cpp


diff --git a/engines/mediastation/actors/timer.cpp b/engines/mediastation/actors/timer.cpp
index 18f96009ec7..f70a65316ed 100644
--- a/engines/mediastation/actors/timer.cpp
+++ b/engines/mediastation/actors/timer.cpp
@@ -110,6 +110,10 @@ void TimerActor::timerEvent(const TimerEvent &event) {
 	// The timer actor is subtly different from other actors that can have timer events called on them,
 	// which is why the default call to process timer events doesn't work here.
 	ScriptResponse *nextTimeScriptResponse = findNextTimeScriptResponseAfter(_lastProcessedTime);
+	if (nextTimeScriptResponse == nullptr) {
+		warning("%s: Expected timer script response after %d", __func__, _lastProcessedTime);
+		return;
+	}
 	double eventTimeInSeconds = nextTimeScriptResponse->_argumentValue.asFloat();
 	uint32 eventTimeInMilliseconds = eventTimeInSeconds * 1000;
 	// Increment by 1 to prevent re-triggering the same event. This works because in the original,


Commit: f8133330037eac394eddb4f7e882e25697787662
    https://github.com/scummvm/scummvm/commit/f8133330037eac394eddb4f7e882e25697787662
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix arguments in wrong order defect (CID 1641367)

Changed paths:
    engines/mediastation/cursors.cpp


diff --git a/engines/mediastation/cursors.cpp b/engines/mediastation/cursors.cpp
index 1c1c6c0eb91..eb341d14def 100644
--- a/engines/mediastation/cursors.cpp
+++ b/engines/mediastation/cursors.cpp
@@ -74,7 +74,7 @@ void CursorManager::newCursor(Chunk &chunk) {
 	switch (cursorType) {
 	case kPlatformCursor: {
 		uint16 platformCursorId = chunk.readTypedUint16();
-		newPlatformCursor(cursorId, platformCursorId);
+		newPlatformCursor(platformCursorId, cursorId);
 		break;
 	}
 


Commit: b1671468859f3417bb748a1b7cf399e688912ed1
    https://github.com/scummvm/scummvm/commit/b1671468859f3417bb748a1b7cf399e688912ed1
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix useless call defect (CID 1645435)

Changed paths:
    engines/mediastation/graphics.cpp


diff --git a/engines/mediastation/graphics.cpp b/engines/mediastation/graphics.cpp
index 23564470b41..5890156769e 100644
--- a/engines/mediastation/graphics.cpp
+++ b/engines/mediastation/graphics.cpp
@@ -229,7 +229,7 @@ void DisplayContext::verifyClipSize() {
 }
 
 void DisplayContext::deleteClips() {
-	_clips.empty();
+	_clips.clear();
 }
 
 bool DisplayContext::clipIsEmpty() {


Commit: 570499815d1c05a96f96412e547fdce440649a85
    https://github.com/scummvm/scummvm/commit/570499815d1c05a96f96412e547fdce440649a85
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix unused value defect (CID 1664000)

Changed paths:
    engines/mediastation/minigames/stalkingzazu.cpp


diff --git a/engines/mediastation/minigames/stalkingzazu.cpp b/engines/mediastation/minigames/stalkingzazu.cpp
index 761f78a97f3..46fa378b786 100644
--- a/engines/mediastation/minigames/stalkingzazu.cpp
+++ b/engines/mediastation/minigames/stalkingzazu.cpp
@@ -1217,10 +1217,11 @@ bool StalkingZazuActor::mousePositionIsInteresting(const Common::Point &pos) {
 	bool isInteresting = true;
 	if (_acceptingMouseEvents) {
 		SpriteMovieActor *simba = static_cast<SpriteMovieActor *>(g_engine->getImtGod()->getActorByIdAndType(_simbaActorId, kActorTypeSprite));
-		if (simba == nullptr) {
+		if (simba != nullptr) {
+			isInteresting = simba->getBbox().contains(pos);
+		} else {
 			isInteresting = false;
 		}
-		isInteresting = simba->getBbox().contains(pos);
 	}
 	return isInteresting;
 }


Commit: 738a9eb96fb098f1c029d3b4f6c1e6f5ef3ef6e3
    https://github.com/scummvm/scummvm/commit/738a9eb96fb098f1c029d3b4f6c1e6f5ef3ef6e3
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Remove unused field. PVS-Studio V703

Changed paths:
    engines/mediastation/actor.h
    engines/mediastation/actors/camera.cpp
    engines/mediastation/actors/camera.h


diff --git a/engines/mediastation/actor.h b/engines/mediastation/actor.h
index 2e276bb96d5..cc84f6d5d17 100644
--- a/engines/mediastation/actor.h
+++ b/engines/mediastation/actor.h
@@ -263,7 +263,6 @@ protected:
 	uint _contextId = 0;
 	Common::String _debugName;
 
-	uint _duration = 0;
 	Common::HashMap<uint, Common::Array<ScriptResponse *> > _scriptResponses;
 
 	// The original had these fields duplicated across several actors, but it made more
diff --git a/engines/mediastation/actors/camera.cpp b/engines/mediastation/actors/camera.cpp
index 68d5f9f147d..8aa08a5a29a 100644
--- a/engines/mediastation/actors/camera.cpp
+++ b/engines/mediastation/actors/camera.cpp
@@ -474,7 +474,7 @@ void CameraActor::panToByTime(int16 x, int16 y, double duration) {
 	_panDest = Common::Point(x, y);
 	_totalPanDuration = duration;
 	_currentPanStep = 1;
-	_startTime = g_engine->getTotalPlayTime();
+	_panStartTime = g_engine->getTotalPlayTime();
 	debugC(6, kDebugCamera, "[%s] %s: panStart: (%d, %d); panDest: (%d, %d); panDuration: %f",
 		debugName(), __func__, _panStart.x, _panStart.y, _panDest.x, _panDest.y, _totalPanDuration);
 	setXYDelta();
@@ -519,7 +519,7 @@ void CameraActor::stopPan() {
 	g_engine->getTimerService()->stopTimer(_timer);
 
 	_totalPanDuration = 0.0;
-	_startTime = 0;
+	_panStartTime = 0;
 	_currentPanStep = 0;
 	_maxPanStep = 0;
 	debugC(6, kDebugCamera, "[%s] %s: nextViewportOrigin: (%d, %d); actualViewportOrigin: (%d, %d)",
@@ -707,7 +707,7 @@ double CameraActor::percentComplete() {
 	case kCameraPanToByTime: {
 		const double MILLISECONDS_IN_ONE_SECOND = 1000.0;
 		uint currentRuntime = g_engine->getTotalPlayTime();
-		uint elapsedTime = currentRuntime - _startTime;
+		uint elapsedTime = currentRuntime - _panStartTime;
 		double elapsedSeconds = elapsedTime / MILLISECONDS_IN_ONE_SECOND;
 		percentValue = elapsedSeconds / _totalPanDuration;
 		break;
diff --git a/engines/mediastation/actors/camera.h b/engines/mediastation/actors/camera.h
index 0f6555b03a6..a0b0b96c4e0 100644
--- a/engines/mediastation/actors/camera.h
+++ b/engines/mediastation/actors/camera.h
@@ -67,7 +67,7 @@ private:
 	double _durationBetweenStepEvents = 0.0;
 	uint _currentPanStep = 0;
 	uint _maxPanStep = 0;
-	uint _startTime = 0;
+	uint _panStartTime = 0;
 	CameraPanState _panState = kCameraNotPanning;
 	Common::Point _offset;
 	Common::Point _currentViewportOrigin;


Commit: 6f9bd3816ba47619becd41cd4e2a12c92e64f793
    https://github.com/scummvm/scummvm/commit/6f9bd3816ba47619becd41cd4e2a12c92e64f793
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix virtual call in constructor. PVS-Studio V1053

Changed paths:
    engines/mediastation/datafile.cpp


diff --git a/engines/mediastation/datafile.cpp b/engines/mediastation/datafile.cpp
index 4c8f8e0b698..d4bc27d21e1 100644
--- a/engines/mediastation/datafile.cpp
+++ b/engines/mediastation/datafile.cpp
@@ -133,7 +133,7 @@ ChannelIdent ParameterReadStream::readTypedChannelIdent() {
 Chunk::Chunk(Common::SeekableReadStream *stream) : _parentStream(stream) {
 	_id = _parentStream->readUint32BE();
 	_length = _parentStream->readUint32LE();
-	_dataStartOffset = pos();
+	_dataStartOffset = _parentStream->pos();
 	_dataEndOffset = _dataStartOffset + _length;
 	debugC(5, kDebugLoading, "%s: Got chunk with ID \"%s\" and size 0x%x", __func__, tag2str(_id), _length);
 }


Commit: 49eaaefa5f1c314bec0c8ed2b0aa3ab29c339398
    https://github.com/scummvm/scummvm/commit/49eaaefa5f1c314bec0c8ed2b0aa3ab29c339398
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Remove redundant nullptr checks. PVS-Studio V547

Changed paths:
    engines/mediastation/actors/canvas.cpp
    engines/mediastation/mediascript/codechunk.cpp


diff --git a/engines/mediastation/actors/canvas.cpp b/engines/mediastation/actors/canvas.cpp
index 6066b05e3da..8feb9d7dfb2 100644
--- a/engines/mediastation/actors/canvas.cpp
+++ b/engines/mediastation/actors/canvas.cpp
@@ -160,11 +160,7 @@ void CanvasActor::stampImage(const Common::Point &dest, uint actorId) {
 	// Set up the display context to draw to the canvas's image surface.
 	if (_image != nullptr) {
 		_displayContext._destImage = &_image->bitmap->_image;
-		if (_displayContext._destImage == nullptr) {
-			_displayContext.deleteClips();
-		} else {
-			_displayContext.verifyClipSize();
-		}
+		_displayContext.verifyClipSize();
 	}
 
 	// Although this method is named stampImage, it can actually stamp other spatial entities too.
diff --git a/engines/mediastation/mediascript/codechunk.cpp b/engines/mediastation/mediascript/codechunk.cpp
index 62d7ff6ed48..77f02a5e0be 100644
--- a/engines/mediastation/mediascript/codechunk.cpp
+++ b/engines/mediastation/mediascript/codechunk.cpp
@@ -420,12 +420,8 @@ ScriptValue CodeChunk::evaluateAssign() {
 		error("%s: Attempt to assign an empty value to a variable", __func__);
 	}
 
-	if (targetVariable != nullptr) {
-		*targetVariable = value;
-		return value;
-	} else {
-		error("%s: Attempt to assign to null variable", __func__);
-	}
+	*targetVariable = value;
+	return value;
 }
 
 ScriptValue CodeChunk::evaluateBinaryOperation(Opcode op) {


Commit: 9360680cab9769399415db2e75a906864b8fc31a
    https://github.com/scummvm/scummvm/commit/9360680cab9769399415db2e75a906864b8fc31a
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Initialize uninitialized members. PVS-Studio V730

Changed paths:
    engines/mediastation/mediascript/scriptvalue.h
    engines/mediastation/statemachine.h


diff --git a/engines/mediastation/mediascript/scriptvalue.h b/engines/mediastation/mediascript/scriptvalue.h
index 1037ef1b241..fead1411ecd 100644
--- a/engines/mediastation/mediascript/scriptvalue.h
+++ b/engines/mediastation/mediascript/scriptvalue.h
@@ -34,7 +34,7 @@ class Actor;
 
 class ScriptValue {
 public:
-	ScriptValue() : _type(kScriptValueTypeEmpty), _collection(nullptr) {}
+	ScriptValue() : _type(kScriptValueTypeEmpty), _u{}, _collection(nullptr) {}
 	ScriptValue(ParameterReadStream *stream);
 	ScriptValue(const ScriptValue &other);
 	~ScriptValue();
diff --git a/engines/mediastation/statemachine.h b/engines/mediastation/statemachine.h
index 30bdcc5a9bc..c2b228531ac 100644
--- a/engines/mediastation/statemachine.h
+++ b/engines/mediastation/statemachine.h
@@ -45,7 +45,7 @@ public:
 	void executeForever();
 
 protected:
-	StateType _currentState;
+	StateType _currentState = StateType();
 	Common::Queue<EventType> _events;
 	bool _handlingEvents = false;
 	virtual void executeNextState(EventType eventType) = 0;


Commit: dbe6368d91a9aefce3395cb4720189be99ebec72
    https://github.com/scummvm/scummvm/commit/dbe6368d91a9aefce3395cb4720189be99ebec72
Author: Nathanael Gentry (nathanael.gentrydb8 at gmail.com)
Date: 2026-07-25T19:10:44-04:00

Commit Message:
MEDIASTATION: Fix potential confusion on lookalike variable names. PVS-Studio V1051

Changed paths:
    engines/mediastation/clients.cpp


diff --git a/engines/mediastation/clients.cpp b/engines/mediastation/clients.cpp
index 43f499213c6..2d1982661f6 100644
--- a/engines/mediastation/clients.cpp
+++ b/engines/mediastation/clients.cpp
@@ -78,10 +78,11 @@ void Document::readStartupInformation(Chunk &chunk) {
 	debugC(5, kDebugLoading, "%s: sectionType = 0x%x", __func__, static_cast<uint>(sectionType));
 	switch (sectionType) {
 	case kDocumentEntryScreen: {
-		uint entryPointScreenId = chunk.readTypedUint16();
+		uint originalEntryPointScreenId = chunk.readTypedUint16();
 		if (_entryPointScreenId == 0) {
-			// We don't want to reset the overridden screen entry point.
-			_entryPointScreenId = entryPointScreenId;
+			// We don't want to reset the overridden screen entry point,
+			// so only actually set the entry point if it has not already been set.
+			_entryPointScreenId = originalEntryPointScreenId;
 		}
 		break;
 	}




More information about the Scummvm-git-logs mailing list