From 84a6a3d9681dc00bca165e6158ea87c37cd7abe4 Mon Sep 17 00:00:00 2001 From: "madmaxoft@gmail.com" Date: Sun, 17 Mar 2013 13:24:27 +0000 Subject: Fluid simulator: fixed an out-of-bounds read when determining fluid direction git-svn-id: http://mc-server.googlecode.com/svn/trunk@1280 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/Simulator/FluidSimulator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source/Simulator') diff --git a/source/Simulator/FluidSimulator.cpp b/source/Simulator/FluidSimulator.cpp index 4648c4cde..df86ef6fc 100644 --- a/source/Simulator/FluidSimulator.cpp +++ b/source/Simulator/FluidSimulator.cpp @@ -119,12 +119,15 @@ bool cFluidSimulator::IsHigherMeta(NIBBLETYPE a_Meta1, NIBBLETYPE a_Meta2) // TODO Not working very well yet :s Direction cFluidSimulator::GetFlowingDirection(int a_X, int a_Y, int a_Z, bool a_Over) { - char BlockID = m_World.GetBlock(a_X, a_Y, a_Z); + if ((a_Y < 0) || (a_Y >= cChunkDef::Height)) + { + return NONE; + } + BLOCKTYPE BlockID = m_World.GetBlock(a_X, a_Y, a_Z); if (!IsAllowedBlock(BlockID)) // No Fluid -> No Flowing direction :D { return NONE; } - /* Disabled because of causing problems and being useless atm -- cgit v1.2.3