From f97bdb1894c01b9d81ff650665ac98ec15620377 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Tue, 30 Apr 2024 11:14:20 +0200 Subject: [PATCH] Add initial size cap to component map --- ...Add-slot-sanity-checks-in-container-clicks.patch | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/patches/server/Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/Add-slot-sanity-checks-in-container-clicks.patch index da061b36f8..dbe1b0a16e 100644 --- a/patches/server/Add-slot-sanity-checks-in-container-clicks.patch +++ b/patches/server/Add-slot-sanity-checks-in-container-clicks.patch @@ -4,6 +4,19 @@ Date: Mon, 11 Sep 2023 12:01:57 +1000 Subject: [PATCH] Add slot sanity checks in container clicks +diff --git a/src/main/java/net/minecraft/core/component/DataComponentPatch.java b/src/main/java/net/minecraft/core/component/DataComponentPatch.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/net/minecraft/core/component/DataComponentPatch.java ++++ b/src/main/java/net/minecraft/core/component/DataComponentPatch.java +@@ -0,0 +0,0 @@ public final class DataComponentPatch { + if (i == 0 && j == 0) { + return DataComponentPatch.EMPTY; + } else { +- Reference2ObjectMap, Optional> reference2objectmap = new Reference2ObjectArrayMap(i + j); ++ Reference2ObjectMap, Optional> reference2objectmap = new Reference2ObjectArrayMap(Math.min(i + j, 256)); // Paper - sensible initial size limit + + DataComponentType datacomponenttype; + int k; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java