2014-04-12 04:49:42 +00:00
|
|
|
From bbf9a4a1446a2b32c4f0e372ef29b50bbf5bc460 Mon Sep 17 00:00:00 2001
|
2014-04-12 04:18:37 +00:00
|
|
|
From: md_5 <git@md-5.net>
|
|
|
|
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
|
2014-04-12 04:49:42 +00:00
|
|
|
index 3eeed3e..78a1b9a 100644
|
2014-04-12 04:18:37 +00:00
|
|
|
--- 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 {
|
|
|
|
|
2014-04-12 04:49:42 +00:00
|
|
|
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
|
2014-04-12 04:18:37 +00:00
|
|
|
int j = datainput.readInt();
|
|
|
|
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
|
|
|
|
|
2014-04-12 04:49:42 +00:00
|
|
|
nbtreadlimiter.a((long) (8 * j));
|
2014-04-12 04:18:37 +00:00
|
|
|
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
|
2014-04-12 04:49:42 +00:00
|
|
|
index c7cea7f..099e16a 100644
|
2014-04-12 04:18:37 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/NBTTagIntArray.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
|
|
|
|
@@ -25,6 +25,7 @@ public class NBTTagIntArray extends NBTBase {
|
|
|
|
|
2014-04-12 04:49:42 +00:00
|
|
|
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
|
2014-04-12 04:18:37 +00:00
|
|
|
int j = datainput.readInt();
|
|
|
|
+ com.google.common.base.Preconditions.checkArgument( j < 1 << 24);
|
|
|
|
|
2014-04-12 04:49:42 +00:00
|
|
|
nbtreadlimiter.a((long) (32 * j));
|
2014-04-12 04:18:37 +00:00
|
|
|
this.data = new int[j];
|
|
|
|
--
|
|
|
|
1.8.3.2
|
|
|
|
|