[Scummvm-git-logs] scummvm branch-2-5 -> eab9052216932be8a55110017b373b6d06530d00

dreammaster dreammaster at scummvm.org
Sun Nov 7 22:59:59 UTC 2021


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:
eab9052216 XEEN: fix out-of-bounds accesses


Commit: eab9052216932be8a55110017b373b6d06530d00
    https://github.com/scummvm/scummvm/commit/eab9052216932be8a55110017b373b6d06530d00
Author: Benoit Pierre (benoit.pierre at gmail.com)
Date: 2021-11-07T14:59:51-08:00

Commit Message:
XEEN: fix out-of-bounds accesses

Changed paths:
    engines/xeen/combat.cpp


diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index b02c6aa41b..4a65ef6914 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -29,39 +29,56 @@
 
 namespace Xeen {
 
-static const int MONSTER_GRID_X[48] = {
-	1, 1, 1, 0, -1, -1, -1, 1, 1, 1, 0, -1,
-	-1, -1, 1, 1, 1, 0, -1, -1, -1, 1, 1, 1,
-	0, -1, -1, -1, 1, 1, 1, 0, -1, -1, -1, 1,
-	1, 1, 0, -1, -1, -1, 1, 1, 1, 0, -1, -1
+#define GRID_SIZE  (7 * 7)
+
+static const int MONSTER_GRID_X[GRID_SIZE] = {
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
+	1, 1, 1, 0, -1, -1, -1,
 };
 
-static const int MONSTER_GRID_Y[48] = {
-	0, 0, 0, -1, 0, 0, 0, 0, 0, 0, -1, 0,
-	0, 0, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,
-	0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0
+static const int MONSTER_GRID_Y[GRID_SIZE] = {
+	0, 0, 0, -1, 0, 0, 0,
+	0, 0, 0, -1, 0, 0, 0,
+	0, 0, 0, -1, 0, 0, 0,
+	0, 0, 0,  0, 0, 0, 0,
+	0, 0, 0, +1, 0, 0, 0,
+	0, 0, 0, +1, 0, 0, 0,
+	0, 0, 0, +1, 0, 0, 0,
 };
 
-static const int MONSTER_GRID3[48] = {
-	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-	- 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 1,
-	0, -1, -1, -1, 1, 1, 1, 1, 1, 1, 1, 1,
-	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
+static const int MONSTER_GRID3[GRID_SIZE] = {
+	-1, -1, -1, -1, -1, -1, -1,
+	-1, -1, -1, -1, -1, -1, -1,
+	-1, -1, -1, -1, -1, -1, -1,
+	+1, +1, +1,  0, -1, -1, -1,
+	+1, +1, +1, +1, +1, +1, +1,
+	+1, +1, +1, +1, +1, +1, +1,
+	+1, +1, +1, +1, +1, +1, +1,
 };
 
-static const int MONSTER_GRID_BITINDEX1[48] = {
-	1, 1, 1, 2, 3, 3, 3, 1, 1, 1, 2, 3,
-	3, 3, 1, 1, 1, 2, 3, 3, 3, 1, 1, 1,
-	0, 3, 3, 3, 1, 1, 1, 0, 3, 3, 3, 1,
-	1, 1, 0, 3, 3, 3, 1, 1, 1, 0, 3, 3
+static const int MONSTER_GRID_BITINDEX1[GRID_SIZE] = {
+	1, 1, 1, 2, 3, 3, 3,
+	1, 1, 1, 2, 3, 3, 3,
+	1, 1, 1, 2, 3, 3, 3,
+	1, 1, 1, 0, 3, 3, 3,
+	1, 1, 1, 0, 3, 3, 3,
+	1, 1, 1, 0, 3, 3, 3,
+	1, 1, 1, 0, 3, 3, 3,
 };
 
-static const int MONSTER_GRID_BITINDEX2[48] = {
-	2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-	2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1,
-	0, 3, 3, 3, 0, 0, 0, 0, 0, 0, 0, 0,
-	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+static const int MONSTER_GRID_BITINDEX2[GRID_SIZE] = {
+	2, 2, 2, 2, 2, 2, 2,
+        2, 2, 2, 2, 2, 2, 2,
+        2, 2, 2, 2, 2, 2, 2,
+        1, 1, 1, 0, 3, 3, 3,
+        0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0,
 };
 
 static const int ATTACK_TYPE_FX[23] = {




More information about the Scummvm-git-logs mailing list