[Scummvm-git-logs] scummvm master -> 4c8395d0832b49a709e66ef7d1695f3edfda7ea8

dreammaster noreply at scummvm.org
Mon Sep 15 07:00:57 UTC 2025


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:
4c8395d083 BAGEL: MINIGAMES: Fix array overruns in Maze O' Doom maze setup


Commit: 4c8395d0832b49a709e66ef7d1695f3edfda7ea8
    https://github.com/scummvm/scummvm/commit/4c8395d0832b49a709e66ef7d1695f3edfda7ea8
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-09-15T00:00:27-07:00

Commit Message:
BAGEL: MINIGAMES: Fix array overruns in Maze O' Doom maze setup

Changed paths:
    engines/bagel/hodjnpodj/mazedoom/mod.cpp


diff --git a/engines/bagel/hodjnpodj/mazedoom/mod.cpp b/engines/bagel/hodjnpodj/mazedoom/mod.cpp
index 95acb1a3b1a..16fa48457c0 100644
--- a/engines/bagel/hodjnpodj/mazedoom/mod.cpp
+++ b/engines/bagel/hodjnpodj/mazedoom/mod.cpp
@@ -1237,19 +1237,23 @@ void SetUpMaze() {
 	for (x = 0; x < NUM_COLUMNS; x++) {         // Now go through  mazeTile and fix up loose ends, as it were
 		for (y = 0; y < NUM_ROWS; y++) {
 			_mazeTile[x][y].m_bHidden = false;
-			if (_mazeTile[x][y].m_nWall == PATH) {
-				if (_mazeTile[x + 1][y + 1].m_nWall == PATH && (_mazeTile[x + 1][y].m_nWall == PATH &&
+
+			if (x > 0 && y > 0 && x < (NUM_COLUMNS - 1) && y < (NUM_ROWS - 1) && _mazeTile[x][y].m_nWall == PATH) {
+				if (_mazeTile[x + 1][y + 1].m_nWall == PATH &&
+					(_mazeTile[x + 1][y].m_nWall == PATH &&
 				        (_mazeTile[x][y + 1].m_nWall == PATH &&
 				         (_mazeTile[x - 1][y].m_nWall == WALL && _mazeTile[x][y - 1].m_nWall == WALL))))
 					_mazeTile[x][y].m_nWall = WALL;              // If it's a right-hand corner
 
-				if (_mazeTile[x][y + 1].m_nWall == PATH && (_mazeTile[x + 1][y - 1].m_nWall == PATH &&
+				if (_mazeTile[x][y + 1].m_nWall == PATH &&
+					(_mazeTile[x + 1][y - 1].m_nWall == PATH &&
 				        (_mazeTile[x - 1][y - 1].m_nWall == PATH &&
 				         (_mazeTile[x - 1][y + 1].m_nWall == PATH && (_mazeTile[x + 1][y + 1].m_nWall == PATH &&
 				                 (_mazeTile[x - 1][y].m_nWall == PATH && _mazeTile[x + 1][y].m_nWall == PATH))))))
 					_mazeTile[x][y].m_nWall = WALL;              // If it's two wide vertically from the top
 
-				if (_mazeTile[x][y - 1].m_nWall == PATH && (_mazeTile[x - 1][y - 1].m_nWall == PATH &&
+				if (_mazeTile[x][y - 1].m_nWall == PATH &&
+					(_mazeTile[x - 1][y - 1].m_nWall == PATH &&
 				        (_mazeTile[x - 1][y + 1].m_nWall == PATH &&
 				         (_mazeTile[x][y + 1].m_nWall == PATH && (_mazeTile[x + 1][y - 1].m_nWall == PATH &&
 				                 (_mazeTile[x + 1][y].m_nWall == PATH && _mazeTile[x + 1][y + 1].m_nWall == PATH))))))
@@ -1717,8 +1721,11 @@ donewall:
 
 int backup() {                                                /* back up a move */
 	_sqNum--;
-	_curSqX = _moveList[_sqNum].x;
-	_curSqY = _moveList[_sqNum].y;
+	if (_sqNum > 0) {
+		_curSqX = _moveList[_sqNum].x;
+		_curSqY = _moveList[_sqNum].y;
+	}
+
 	return _sqNum;
 }
 




More information about the Scummvm-git-logs mailing list