[Scummvm-git-logs] scummvm master -> 8cbd13979e37364f48b7c025a58e36d5d0e1749a

Strangerke noreply at scummvm.org
Tue Feb 7 22:34:54 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:
8cbd13979e EFH: Add a couple of safeguards


Commit: 8cbd13979e37364f48b7c025a58e36d5d0e1749a
    https://github.com/scummvm/scummvm/commit/8cbd13979e37364f48b7c025a58e36d5d0e1749a
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2023-02-07T23:34:25+01:00

Commit Message:
EFH: Add a couple of safeguards

Changed paths:
    engines/efh/efh.cpp


diff --git a/engines/efh/efh.cpp b/engines/efh/efh.cpp
index 490555a0691..616917d9fb1 100644
--- a/engines/efh/efh.cpp
+++ b/engines/efh/efh.cpp
@@ -1955,7 +1955,11 @@ void EfhEngine::displayImp1Text(int16 textId) {
 		for (;;) {
 			uint8 *curString = nullptr;
 			if (curTextId >= 0 && curTextId <= 0xFE) {
-				curString = _imp1PtrArray[curTextId];
+				if (curTextId >= 100)
+					// Safeguard
+					warning("Unexpected value in displayImp1Text: %d", curTextId);
+				else
+					curString = _imp1PtrArray[curTextId];
 			}
 
 			curTextId = 0xFF;
@@ -2127,7 +2131,10 @@ bool EfhEngine::handleInteractionText(int16 mapPosX, int16 mapPosY, int16 charId
 			return true;
 	}
 
-	// CHECKME: there's suspiciously no check on tileId
+	// Safeguard
+	if (tileId < 0)
+		return false;
+
 	if ((arg8 == 4 && _mapSpecialTiles[_techId][tileId]._triggerType < 0xFA) || arg8 != 4) {
 		if (_mapSpecialTiles[_techId][tileId]._field7_textId > 0xFE)
 			return false;




More information about the Scummvm-git-logs mailing list