From c0d376e24202968e5cec4e82d7cecdbd2efb1ad0 Mon Sep 17 00:00:00 2001 From: Spottedleaf Date: Fri, 16 Jun 2023 10:27:59 -0700 Subject: [PATCH] Copy itemstack when sanitizing for datawatcher items Since the packet is broadcasted for players, it means that the packet will be sent to multiple players. In this case, modifying the data results in a possible race condition where a CME may occur as the packet will be serialized on many different netty IO threads. --- .../Prevent-sending-oversized-item-data-in-equipment-and.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch index 6e5d75a6c5..3e66b33b0e 100644 --- a/patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -13,7 +13,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @Override public void write(FriendlyByteBuf buf, ItemStack value) { - buf.writeItem(value); -+ buf.writeItem(net.minecraft.world.entity.LivingEntity.sanitizeItemStack(value, false)); // Paper - prevent oversized data ++ buf.writeItem(net.minecraft.world.entity.LivingEntity.sanitizeItemStack(value, true)); // Paper - prevent oversized data } @Override