[Scummvm-git-logs] scummvm master -> 32e36a92c3da64546232ca3392c56fd8db288851

neuromancer noreply at scummvm.org
Sun Jul 12 09:03:27 UTC 2026


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

Summary:
32e36a92c3 SCUMM: RA: small fixes from coverity, mostly defensive code


Commit: 32e36a92c3da64546232ca3392c56fd8db288851
    https://github.com/scummvm/scummvm/commit/32e36a92c3da64546232ca3392c56fd8db288851
Author: neuromancer (gustavo.grieco at gmail.com)
Date: 2026-07-12T10:48:00+02:00

Commit Message:
SCUMM: RA: small fixes from coverity, mostly defensive code

Changed paths:
    engines/scumm/insane/insane.h
    engines/scumm/insane/rebel1/render.cpp
    engines/scumm/insane/rebel2/levels.cpp
    engines/scumm/insane/rebel2/render.cpp
    engines/scumm/smush/rebel/smush_player_ra2.cpp


diff --git a/engines/scumm/insane/insane.h b/engines/scumm/insane/insane.h
index b610ccdc7b2..b3611fd66b1 100644
--- a/engines/scumm/insane/insane.h
+++ b/engines/scumm/insane/insane.h
@@ -50,7 +50,8 @@ namespace Scumm {
 
 class Insane {
 public:
-	Insane() {}
+	// Used by the Rebel Assault subclasses; _player is only set later, by setSmushPlayer().
+	Insane() : _vm(nullptr), _player(nullptr), _speed(0), _insaneIsRunning(false) {}
 	Insane(ScummEngine_v7 *scumm);
 	virtual ~Insane();
 
diff --git a/engines/scumm/insane/rebel1/render.cpp b/engines/scumm/insane/rebel1/render.cpp
index 0c000abb033..9a34d3975dd 100644
--- a/engines/scumm/insane/rebel1/render.cpp
+++ b/engines/scumm/insane/rebel1/render.cpp
@@ -578,8 +578,8 @@ void InsaneRebel1::procPostRendering(byte *renderBitmap, int32 codecparam, int32
 	if (!_interactiveVideoActive || !renderBitmap)
 		return;
 
-	int width = _player->_width;
-	int height = _player->_height;
+	int width = _player ? _player->_width : 0;
+	int height = _player ? _player->_height : 0;
 	if (width == 0) width = _screenWidth;
 	if (height == 0) height = _screenHeight;
 	int pitch = width;
diff --git a/engines/scumm/insane/rebel2/levels.cpp b/engines/scumm/insane/rebel2/levels.cpp
index a58012ad465..0aa7e4e5f36 100644
--- a/engines/scumm/insane/rebel2/levels.cpp
+++ b/engines/scumm/insane/rebel2/levels.cpp
@@ -139,8 +139,6 @@ void InsaneRebel2::runGame() {
 							break;
 						}
 					} else {
-						if (_vm->shouldQuit() || result == kLevelQuit)
-							break;
 						break;
 					}
 				}
diff --git a/engines/scumm/insane/rebel2/render.cpp b/engines/scumm/insane/rebel2/render.cpp
index ba1fdc120f2..21ab71f798b 100644
--- a/engines/scumm/insane/rebel2/render.cpp
+++ b/engines/scumm/insane/rebel2/render.cpp
@@ -2536,7 +2536,7 @@ void InsaneRebel2::initDamageFlash() {
 		_damageRestorePaletteValid = true;
 	}
 
-	if (_damageFlashCounter == 0) {
+	if (_damageFlashCounter == 0 && _player) {
 		memcpy(_damageSavedPalette, _player->_pal, 0x300);
 	}
 	_damageFlashCounter = 5;
diff --git a/engines/scumm/smush/rebel/smush_player_ra2.cpp b/engines/scumm/smush/rebel/smush_player_ra2.cpp
index 7d3d41aa0a8..f478984e1f7 100644
--- a/engines/scumm/smush/rebel/smush_player_ra2.cpp
+++ b/engines/scumm/smush/rebel/smush_player_ra2.cpp
@@ -267,17 +267,22 @@ void SmushPlayerRebel2::ra2ClearCurrentTarget() {
 	if (!_dst)
 		return;
 
+	// Match the off-screen buffers on identity alone: they can be smaller than the
+	// screen (424x260 against 640x400), so a bad _width/_height must not reach the
+	// screen-sized clear below.
 	int clearSize = 0;
-	if (_dst == _specialBuffer && _width > 0 && _height > 0) {
+	if (_dst == _specialBuffer) {
 		const int64 size64 = (int64)_width * _height;
-		if (size64 <= INT_MAX && size64 <= _specialBufferSize)
+		if (_width > 0 && _height > 0 && size64 <= INT_MAX && size64 <= _specialBufferSize)
 			clearSize = (int)size64;
-	} else if (_dst == _ra2LowResVideoBuffer && _width > 0 && _height > 0) {
+	} else if (_dst == _ra2LowResVideoBuffer) {
 		const int64 size64 = (int64)_width * _height;
-		if (size64 <= INT_MAX && size64 <= _ra2LowResVideoBufferSize)
+		if (_width > 0 && _height > 0 && size64 <= INT_MAX && size64 <= _ra2LowResVideoBufferSize)
 			clearSize = (int)size64;
 	} else {
-		clearSize = _vm->_screenWidth * _vm->_screenHeight;
+		const int64 screen64 = (int64)_vm->_screenWidth * _vm->_screenHeight;
+		if (screen64 > 0 && screen64 <= INT_MAX)
+			clearSize = (int)screen64;
 	}
 
 	if (clearSize > 0)




More information about the Scummvm-git-logs mailing list