Improve NBTReadLimiter
This commit is contained in:
@@ -21,6 +21,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
NBTBase nbtbase = a(datainput, 0, nbtreadlimiter);
|
||||
|
||||
if (nbtbase instanceof NBTTagCompound) {
|
||||
diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
+++ b/src/main/java/net/minecraft/server/NBTTagList.java
|
||||
@@ -0,0 +0,0 @@ public class NBTTagList extends NBTBase {
|
||||
|
||||
for (int k = 0; k < j; ++k) {
|
||||
NBTBase nbtbase = NBTBase.createTag(this.type);
|
||||
+ nbtreadlimiter.a(8); // Spigot
|
||||
|
||||
nbtbase.load(datainput, i + 1, nbtreadlimiter);
|
||||
this.list.add(nbtbase);
|
||||
diff --git a/src/main/java/org/spigotmc/LimitStream.java b/src/main/java/org/spigotmc/LimitStream.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
@@ -48,21 +60,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ @Override
|
||||
+ public int read() throws IOException
|
||||
+ {
|
||||
+ limit.a( 1 );
|
||||
+ limit.a( 8 );
|
||||
+ return super.read();
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int read(byte[] b) throws IOException
|
||||
+ {
|
||||
+ limit.a( b.length );
|
||||
+ limit.a( b.length * 8 );
|
||||
+ return super.read( b );
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public int read(byte[] b, int off, int len) throws IOException
|
||||
+ {
|
||||
+ limit.a( len );
|
||||
+ limit.a( len * 8 );
|
||||
+ return super.read( b, off, len );
|
||||
+ }
|
||||
+}
|
||||
|
||||
Reference in New Issue
Block a user