aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch
diff options
context:
space:
mode:
authorNassim Jahnke <[email protected]>2024-04-30 11:14:20 +0200
committerNassim Jahnke <[email protected]>2024-04-30 11:14:35 +0200
commit937a67a65172aa7ed2efafd536bbf7cfab2e3489 (patch)
tree399b0509976185a148c9f53f1c65763210a30abc /patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch
parent3fdd0948b7713541a80d1755719ee210311a3850 (diff)
downloadPaper-937a67a65172aa7ed2efafd536bbf7cfab2e3489.tar.gz
Paper-937a67a65172aa7ed2efafd536bbf7cfab2e3489.zip
Add initial size cap to component map
Diffstat (limited to 'patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch')
-rw-r--r--patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch13
1 files changed, 13 insertions, 0 deletions
diff --git a/patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch
index ddbb17de53..20c2b0eda6 100644
--- a/patches/server/0905-Add-slot-sanity-checks-in-container-clicks.patch
+++ b/patches/server/0905-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 b69fa76003d948e307cf83d72a57513a984e622d..913327c9bb937c95e487ba21cf8e2084817bbfdb 100644
+--- a/src/main/java/net/minecraft/core/component/DataComponentPatch.java
++++ b/src/main/java/net/minecraft/core/component/DataComponentPatch.java
+@@ -71,7 +71,7 @@ public final class DataComponentPatch {
+ if (i == 0 && j == 0) {
+ return DataComponentPatch.EMPTY;
+ } else {
+- Reference2ObjectMap<DataComponentType<?>, Optional<?>> reference2objectmap = new Reference2ObjectArrayMap(i + j);
++ Reference2ObjectMap<DataComponentType<?>, 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 ff8593b3835be310affc39cde964fabfcc105094..eebc68f55374d5763c77d1fbf884b17612fcd1fb 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java