13
0
geforkt von Mirrors/Paper

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.
Dieser Commit ist enthalten in:
Spottedleaf 2023-06-16 10:27:59 -07:00
Ursprung f5551380b3
Commit a226f44b45

Datei anzeigen

@ -5,7 +5,7 @@ Subject: [PATCH] Prevent sending oversized item data in equipment and metadata
diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java diff --git a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
index 97da8896865ff0bdd4fe8f2155b0830b42051bb1..17d0519ce3c097a38f9867fff3e1c25eb7febb59 100644 index 97da8896865ff0bdd4fe8f2155b0830b42051bb1..9ca897d92c5bdd2764d114c74d64c776674d6beb 100644
--- a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java --- a/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
+++ b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java +++ b/src/main/java/net/minecraft/network/syncher/EntityDataSerializers.java
@@ -42,7 +42,7 @@ public class EntityDataSerializers { @@ -42,7 +42,7 @@ public class EntityDataSerializers {
@ -13,7 +13,7 @@ index 97da8896865ff0bdd4fe8f2155b0830b42051bb1..17d0519ce3c097a38f9867fff3e1c25e
@Override @Override
public void write(FriendlyByteBuf buf, ItemStack value) { public void write(FriendlyByteBuf buf, ItemStack value) {
- buf.writeItem(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 @Override