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

Strangerke noreply at scummvm.org
Mon Feb 6 23:59:43 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:
ccf011aa66 EFH: Fix some coverity issues


Commit: ccf011aa66b83c6cfa55bf93c4fb0287912a120f
    https://github.com/scummvm/scummvm/commit/ccf011aa66b83c6cfa55bf93c4fb0287912a120f
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2023-02-07T00:59:31+01:00

Commit Message:
EFH: Fix some coverity issues

Changed paths:
    engines/efh/efh.cpp
    engines/efh/savegames.cpp
    engines/efh/script.cpp


diff --git a/engines/efh/efh.cpp b/engines/efh/efh.cpp
index 442ea75beb2..490555a0691 100644
--- a/engines/efh/efh.cpp
+++ b/engines/efh/efh.cpp
@@ -771,6 +771,10 @@ void EfhEngine::totalPartyKill() {
 void EfhEngine::removeCharacterFromTeam(int16 teamMemberId) {
 	debugC(6, kDebugEngine, "removeCharacterFromTeam %d", teamMemberId);
 
+	// Safeguard
+	if (teamMemberId < 0 || teamMemberId >= _teamSize)
+		return;
+	
 	int16 charId = _teamChar[teamMemberId]._id;
 	_npcBuf[charId].field12_textId = _npcBuf[charId].fieldB_textId;
 	_npcBuf[charId].field14_textId = _npcBuf[charId].fieldE_textId;
diff --git a/engines/efh/savegames.cpp b/engines/efh/savegames.cpp
index 33ab3d7fa29..a4085d890dc 100644
--- a/engines/efh/savegames.cpp
+++ b/engines/efh/savegames.cpp
@@ -58,7 +58,9 @@ Common::Error EfhEngine::loadGameState(int slot) {
 
 	// Skip the thumbnail
 	Graphics::Surface *thumbnail;
-	Graphics::loadThumbnail(*saveFile, thumbnail);
+	if (!Graphics::loadThumbnail(*saveFile, thumbnail))
+		return Common::kReadingFailed;
+	
 	delete (thumbnail);
 
 	// Skip the savegame date
diff --git a/engines/efh/script.cpp b/engines/efh/script.cpp
index 93f20ecf09e..80233c3293d 100644
--- a/engines/efh/script.cpp
+++ b/engines/efh/script.cpp
@@ -474,7 +474,7 @@ int16 EfhEngine::script_parse(Common::String stringBuffer, int16 posX, int16 pos
 		}
 	}
 
-	if (curLineNb < numbLines && !noTextFlag)
+	if (!curLine.empty() && curLineNb < numbLines && !noTextFlag)
 		displayStringAtTextPos(curLine);
 
 	if (joiningNpcId != 0xFF) {




More information about the Scummvm-git-logs mailing list