From 7b87bc6970ec6169c9877cf4cb0720c7be909f12 Mon Sep 17 00:00:00 2001 From: David Eriksson Date: Mon, 6 Oct 2003 08:24:38 +0000 Subject: Check array bounds. svn-id: r10633 --- queen/logic.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'queen') diff --git a/queen/logic.cpp b/queen/logic.cpp index c21a1f8fe1..d7e37ad137 100644 --- a/queen/logic.cpp +++ b/queen/logic.cpp @@ -139,9 +139,9 @@ void Logic::initialise() { ptr += 2; } - _objMax = new int16[_numRooms + 1]; - _areaMax = new int16[_numRooms + 1]; - _area = new int16[_numRooms + 1][11][8]; + _objMax = new int16[_numRooms + 1]; + _areaMax = new int16[_numRooms + 1]; + _area = new int16[_numRooms + 1][11][8]; for (i = 1; i < (_numRooms + 1); i++) { _objMax[i] = (int16)READ_BE_UINT16(ptr); @@ -151,6 +151,8 @@ void Logic::initialise() { for (j = 1; j < (_areaMax[i] + 1); j++) for (k = 0; k < 8; k++) { + if (j > 11) + error("j (%i) too large, _areaMax[i] = %i", j, _areaMax[i]); _area[i][j][k] = READ_BE_UINT16(ptr); ptr += 2; } -- cgit v1.2.3