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

Strangerke noreply at scummvm.org
Sat Feb 25 08:23:04 UTC 2023


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

Summary:
f8883f9867 EFH: Fix 3 Coverity issues


Commit: f8883f986742568eb99cc2bcaefb0c1e23f1ddc4
    https://github.com/scummvm/scummvm/commit/f8883f986742568eb99cc2bcaefb0c1e23f1ddc4
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2023-02-25T09:22:52+01:00

Commit Message:
EFH: Fix 3 Coverity issues

Changed paths:
    engines/efh/fight.cpp
    engines/efh/sound.cpp


diff --git a/engines/efh/fight.cpp b/engines/efh/fight.cpp
index 2c2655fb363..abf16be6d89 100644
--- a/engines/efh/fight.cpp
+++ b/engines/efh/fight.cpp
@@ -750,8 +750,8 @@ void EfhEngine::getDeathTypeDescription(int16 victimId, int16 attackerId) {
 			else
 				deathType = _items[exclusiveItemId]._attackType + 1;
 		}
-	// The check "attackerId > 5" is a safeguard for a Coverity "OVERRUN" ticket, not present in the original
-	} else if (attackerId > 5 || _teamMonster[attackerId]._id == -1) {
+	// The check "attackerId >= 5" is a safeguard for a Coverity "OVERRUN" ticket, not present in the original
+	} else if (attackerId >= 5 || _teamMonster[attackerId]._id == -1) {
 		deathType = 0;
 	} else {
 		int16 itemId = _mapMonsters[_techId][_teamMonster[attackerId]._id]._weaponItemId;
diff --git a/engines/efh/sound.cpp b/engines/efh/sound.cpp
index 62e1851a248..309204fb1e1 100644
--- a/engines/efh/sound.cpp
+++ b/engines/efh/sound.cpp
@@ -35,9 +35,13 @@ void EfhEngine::songDelay(int delay) {
 
 void EfhEngine::playNote(int frequencyIndex, int totalDelay) {
 	debugC(3, kDebugEngine, "playNote %d %d", frequencyIndex, totalDelay);
-	_speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, 0x1234DD / kSoundFrequency[frequencyIndex], -1);
-	songDelay(totalDelay);
-	_speakerStream->stop();
+	if (frequencyIndex > 0 && frequencyIndex < 72) {
+		_speakerStream->play(Audio::PCSpeaker::kWaveFormSquare, 0x1234DD / kSoundFrequency[frequencyIndex], -1);
+		songDelay(totalDelay);
+		_speakerStream->stop();
+	} else {
+		warning("playNote - Skip note with frequency index %d", frequencyIndex);
+	}
 }
 
 Common::KeyCode EfhEngine::playSong(uint8 *buffer) {




More information about the Scummvm-git-logs mailing list