From 6b3900f3cc727b5ba9b47a4804235e1e7c6825fc Mon Sep 17 00:00:00 2001 From: md_5 Date: Mon, 20 Jan 2014 13:44:07 +1100 Subject: [PATCH] Catch stalling on corrupted map data / NBT arrays. diff --git a/src/main/java/net/minecraft/server/NBTTagByteArray.java b/src/main/java/net/minecraft/server/NBTTagByteArray.java index 3eeed3e..4e9b714 100644 --- a/src/main/java/net/minecraft/server/NBTTagByteArray.java +++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java @@ -22,6 +22,7 @@ public class NBTTagByteArray extends NBTBase { void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { int j = datainput.readInt(); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (8 * j)); this.data = new byte[j]; diff --git a/src/main/java/net/minecraft/server/NBTTagIntArray.java b/src/main/java/net/minecraft/server/NBTTagIntArray.java index 63c3bf9..1ff0902 100644 --- a/src/main/java/net/minecraft/server/NBTTagIntArray.java +++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java @@ -26,6 +26,7 @@ public class NBTTagIntArray extends NBTBase { void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException { int j = datainput.readInt(); + com.google.common.base.Preconditions.checkArgument( j < 1 << 24); nbtreadlimiter.a((long) (32 * j)); this.data = new int[j]; -- 2.1.0