Files
CatServer/spigot-patches/CraftBukkit-Patches/0072-Apply-NBTReadLimiter-to-more-things.patch
2023-03-11 14:12:09 +08:00

27 lines
1.1 KiB
Diff

From 301d4e677703bfe3396849129f60372bfaee7c5c Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 27 Jul 2014 20:46:04 +1000
Subject: [PATCH] Apply NBTReadLimiter to more things.
diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java
index 392598dce..438b56859 100644
--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java
+++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java
@@ -229,6 +229,12 @@ public class NBTCompressedStreamTools {
}
public static NBTTagCompound read(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException {
+ // Spigot start
+ if ( datainput instanceof io.netty.buffer.ByteBufInputStream )
+ {
+ datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter));
+ }
+ // Spigot end
NBTBase nbtbase = readUnnamedTag(datainput, 0, nbtreadlimiter);
if (nbtbase instanceof NBTTagCompound) {
--
2.25.1