13
0
geforkt von Mirrors/Paper
Paper/CraftBukkit-Patches/0071-Catch-stalling-on-corrupted-map-data-NBT-arrays.patch
2015-05-18 16:56:05 -05:00

34 Zeilen
1.5 KiB
Diff

From fa21783447705aa61405d57413882a1973c38907 Mon Sep 17 00:00:00 2001
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
index c6b5f70..13e9d0b 100644
--- a/src/main/java/net/minecraft/server/NBTTagByteArray.java
+++ b/src/main/java/net/minecraft/server/NBTTagByteArray.java
@@ -23,6 +23,7 @@ public class NBTTagByteArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
nbtreadlimiter.a(192L);
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 5f17034..e206e50 100644
--- a/src/main/java/net/minecraft/server/NBTTagIntArray.java
+++ b/src/main/java/net/minecraft/server/NBTTagIntArray.java
@@ -27,6 +27,7 @@ public class NBTTagIntArray extends NBTBase {
void load(DataInput datainput, int i, NBTReadLimiter nbtreadlimiter) throws IOException {
nbtreadlimiter.a(192L);
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.4