mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-30 16:19:03 +01:00
Catch stalling on corrupted map data / NBT arrays.
By: md_5 <git@md-5.net>
This commit is contained in:
parent
1f67404bb9
commit
bfc73d87f0
2 changed files with 16 additions and 0 deletions
|
@ -5,3 +5,11 @@
|
||||||
package net.minecraft.nbt;
|
package net.minecraft.nbt;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
|
@@ -24,6 +25,7 @@
|
||||||
|
private static byte[] readAccounted(DataInput input, NbtAccounter tracker) throws IOException {
|
||||||
|
tracker.accountBytes(24L);
|
||||||
|
int i = input.readInt();
|
||||||
|
+ com.google.common.base.Preconditions.checkArgument( i < 1 << 24); // Spigot
|
||||||
|
|
||||||
|
tracker.accountBytes(1L, (long) i);
|
||||||
|
byte[] abyte = new byte[i];
|
||||||
|
|
|
@ -5,3 +5,11 @@
|
||||||
package net.minecraft.nbt;
|
package net.minecraft.nbt;
|
||||||
|
|
||||||
import java.io.DataInput;
|
import java.io.DataInput;
|
||||||
|
@@ -24,6 +25,7 @@
|
||||||
|
private static int[] readAccounted(DataInput input, NbtAccounter tracker) throws IOException {
|
||||||
|
tracker.accountBytes(24L);
|
||||||
|
int i = input.readInt();
|
||||||
|
+ com.google.common.base.Preconditions.checkArgument( i < 1 << 24); // Spigot
|
||||||
|
|
||||||
|
tracker.accountBytes(4L, (long) i);
|
||||||
|
int[] aint = new int[i];
|
||||||
|
|
Loading…
Reference in a new issue