From 2c8517f4d77556159333169243cfd0ded355491a Mon Sep 17 00:00:00 2001 From: Christian Date: Sun, 7 Oct 2012 00:28:42 -0400 Subject: [PATCH] Fix bounds checking on chunkcache. Should fix a bunch of rp2 and maybe other extended tile entity code --- .../net/minecraft/src/ChunkCache.java.patch | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 patches/common/net/minecraft/src/ChunkCache.java.patch diff --git a/patches/common/net/minecraft/src/ChunkCache.java.patch b/patches/common/net/minecraft/src/ChunkCache.java.patch new file mode 100644 index 000000000..2fd8b1428 --- /dev/null +++ b/patches/common/net/minecraft/src/ChunkCache.java.patch @@ -0,0 +1,33 @@ +--- ../src_base/common/net/minecraft/src/ChunkCache.java ++++ ../src_work/common/net/minecraft/src/ChunkCache.java +@@ -91,7 +91,15 @@ + { + int var4 = (par1 >> 4) - this.chunkX; + int var5 = (par3 >> 4) - this.chunkZ; +- return this.chunkArray[var4][var5].getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); ++ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) ++ { ++ Chunk var6 = this.chunkArray[var4][var5]; ++ return var6 == null ? null : var6.getChunkBlockTileEntity(par1 & 15, par2, par3 & 15); ++ } ++ else ++ { ++ return null; ++ } + } + + @SideOnly(Side.CLIENT) +@@ -239,7 +247,12 @@ + { + int var4 = (par1 >> 4) - this.chunkX; + int var5 = (par3 >> 4) - this.chunkZ; +- return this.chunkArray[var4][var5].getBlockMetadata(par1 & 15, par2, par3 & 15); ++ if (var4 >= 0 && var4 < this.chunkArray.length && var5 >= 0 && var5 < this.chunkArray[var4].length) ++ { ++ Chunk var6 = this.chunkArray[var4][var5]; ++ return var6 == null ? 0 : var6.getBlockMetadata(par1 & 15, par2, par3 & 15); ++ } ++ return 0; + } + } +