From 7cd4f2c15fbd12637c2161779986f8b56aa0a59e Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 3 Oct 2024 17:10:27 +0200 Subject: [PATCH] Check if leash tag has a uuid --- ...date-ResourceLocation-in-NBT-reading.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/patches/server/0918-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0918-Validate-ResourceLocation-in-NBT-reading.patch index 48e7f7dede..923bdbe37d 100644 --- a/patches/server/0918-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0918-Validate-ResourceLocation-in-NBT-reading.patch @@ -65,6 +65,25 @@ index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffa } @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java +index e7535f15be3cc1537aafee53779ccfb4f21d1f38..bd6d587cedfe0e345536d7ebb6b7ca204f073efe 100644 +--- a/src/main/java/net/minecraft/world/entity/Leashable.java ++++ b/src/main/java/net/minecraft/world/entity/Leashable.java +@@ -54,7 +54,13 @@ public interface Leashable { + @Nullable + default Leashable.LeashData readLeashData(CompoundTag nbt) { + if (nbt.contains("leash", 10)) { +- return new Leashable.LeashData(Either.left(nbt.getCompound("leash").getUUID("UUID"))); ++ // Paper start ++ final CompoundTag leashTag = nbt.getCompound("leash"); ++ if (!leashTag.hasUUID("UUID")) { ++ return null; ++ } ++ return new Leashable.LeashData(Either.left(leashTag.getUUID("UUID"))); ++ // Paper end + } else { + if (nbt.contains("leash", 11)) { + Either either = (Either) NbtUtils.readBlockPos(nbt, "leash").map(Either::right).orElse(null); // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java index 13ef1ad250b56dbadba0244186e369d7ba9b5c0e..94169703c5a8111df1ed550d57f59f4a3bb97ae1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java