From 728e3c68b61e68d4cb73071cf04b44d268742aca Mon Sep 17 00:00:00 2001 From: madmaxoft Date: Sun, 23 Feb 2014 16:30:49 +0100 Subject: [PATCH] Fixed a possible crash in cWorld::WakeUpSimulatorsInArea(). The Y coords weren't checked. --- src/ChunkMap.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ChunkMap.cpp b/src/ChunkMap.cpp index fbb8706e0..b5795fbaf 100644 --- a/src/ChunkMap.cpp +++ b/src/ChunkMap.cpp @@ -805,6 +805,10 @@ void cChunkMap::WakeUpSimulators(int a_BlockX, int a_BlockY, int a_BlockZ) /// Wakes up the simulators for the specified area of blocks void cChunkMap::WakeUpSimulatorsInArea(int a_MinBlockX, int a_MaxBlockX, int a_MinBlockY, int a_MaxBlockY, int a_MinBlockZ, int a_MaxBlockZ) { + // Limit the Y coords: + a_MinBlockY = std::max(a_MinBlockY, 0); + a_MaxBlockY = std::min(a_MaxBlockY, cChunkDef::Height - 1); + cSimulatorManager * SimMgr = m_World->GetSimulatorManager(); int MinChunkX, MinChunkZ, MaxChunkX, MaxChunkZ; cChunkDef::BlockToChunk(a_MinBlockX, a_MinBlockZ, MinChunkX, MinChunkZ);