--- a/net/minecraft/nbt/ByteArrayTag.java
+++ b/net/minecraft/nbt/ByteArrayTag.java
@@ -23,6 +_,7 @@
         private static byte[] readAccounted(DataInput input, NbtAccounter accounter) throws IOException {
             accounter.accountBytes(24L);
             int _int = input.readInt();
+            com.google.common.base.Preconditions.checkArgument(_int < 1 << 24); // Spigot
             accounter.accountBytes(1L, _int);
             byte[] bytes = new byte[_int];
             input.readFully(bytes);
