aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorcaramel <[email protected]>2023-10-15 23:11:15 +0900
committerGitHub <[email protected]>2023-10-15 15:11:15 +0100
commit44ee1cd05e5dea4a2537077bff4114e47962bd19 (patch)
tree3d1242122ea823f30651f5b5370d9c20777fa9f5
parent852c1c236d080d9fd907a5f4fd3e850437996aa2 (diff)
downloadPaper-44ee1cd05e5dea4a2537077bff4114e47962bd19.tar.gz
Paper-44ee1cd05e5dea4a2537077bff4114e47962bd19.zip
fix recipe packet limiter (#9841)
-rw-r--r--patches/server/0500-Limit-recipe-packets.patch5
-rw-r--r--patches/server/0611-Add-PlayerKickEvent-causes.patch8
-rw-r--r--patches/server/0796-Prevent-tile-entity-copies-loading-chunks.patch4
-rw-r--r--patches/server/0810-Do-not-accept-invalid-client-settings.patch4
-rw-r--r--patches/server/0901-Improve-logging-and-errors.patch4
-rw-r--r--patches/server/0910-Use-single-player-info-update-packet-on-join.patch4
-rw-r--r--patches/server/0932-Prevent-causing-expired-keys-from-impacting-new-join.patch4
7 files changed, 16 insertions, 17 deletions
diff --git a/patches/server/0500-Limit-recipe-packets.patch b/patches/server/0500-Limit-recipe-packets.patch
index d1daf7e9c5..77284ad6e1 100644
--- a/patches/server/0500-Limit-recipe-packets.patch
+++ b/patches/server/0500-Limit-recipe-packets.patch
@@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index d8174c67d31fa8b6730a80a8e2399eed5737f838..a32e63f4ffff849aa13daf831b1e436c1112dde2 100644
+index d8174c67d31fa8b6730a80a8e2399eed5737f838..44dd71b7789a7e66a6d2a94c241b535a2f4cbb86 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -254,6 +254,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -24,11 +24,10 @@ index d8174c67d31fa8b6730a80a8e2399eed5737f838..a32e63f4ffff849aa13daf831b1e436c
/* Use thread-safe field access instead
if (this.chatSpamTickCount > 0) {
--this.chatSpamTickCount;
-@@ -2974,6 +2976,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -2974,6 +2976,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) {
-+ PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
+ // Paper start
+ if (!org.bukkit.Bukkit.isPrimaryThread()) {
+ if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
diff --git a/patches/server/0611-Add-PlayerKickEvent-causes.patch b/patches/server/0611-Add-PlayerKickEvent-causes.patch
index f7ef0ed89b..16e21badd0 100644
--- a/patches/server/0611-Add-PlayerKickEvent-causes.patch
+++ b/patches/server/0611-Add-PlayerKickEvent-causes.patch
@@ -197,7 +197,7 @@ index 95d37df1b51453722d47eb07e2e0247f308fa171..125a9d1ae394db4b0d5418756d50e32f
if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event);
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index c4f43ce78f6cf28deee2dbf2bfd942e6b7976a52..7057bcb958f2ddf71cf6ec28be02a5aa32266436 100644
+index 4a5c462998d833e5377c79cf5ded843a8cc71d48..9cd00fce9dadd65020de9c48524416d6d3c82bc4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -340,7 +340,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -406,7 +406,7 @@ index c4f43ce78f6cf28deee2dbf2bfd942e6b7976a52..7057bcb958f2ddf71cf6ec28be02a5aa
ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString());
}
}
-@@ -2998,7 +2998,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -2997,7 +2997,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
// Paper start
if (!org.bukkit.Bukkit.isPrimaryThread()) {
if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) {
@@ -415,7 +415,7 @@ index c4f43ce78f6cf28deee2dbf2bfd942e6b7976a52..7057bcb958f2ddf71cf6ec28be02a5aa
return;
}
}
-@@ -3233,7 +3233,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3232,7 +3232,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) {
if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) {
@@ -424,7 +424,7 @@ index c4f43ce78f6cf28deee2dbf2bfd942e6b7976a52..7057bcb958f2ddf71cf6ec28be02a5aa
} else {
try {
SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator();
-@@ -3246,7 +3246,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3245,7 +3245,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage());
diff --git a/patches/server/0796-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0796-Prevent-tile-entity-copies-loading-chunks.patch
index 68f5cebe43..5619c86549 100644
--- a/patches/server/0796-Prevent-tile-entity-copies-loading-chunks.patch
+++ b/patches/server/0796-Prevent-tile-entity-copies-loading-chunks.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 42860936789e66128615d3d2dc7a2a7bf139240b..7f96ba2095bee348cb6bb7796471aa7cdd1999d3 100644
+index db7d4a74021873a86a06f39c43d36804d97e4fdb..43ee0a36ace19a29f4e63133462ffc63a88b38e4 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -3188,7 +3188,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3187,7 +3187,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
BlockPos blockposition = BlockEntity.getPosFromTag(nbttagcompound);
if (this.player.level().isLoaded(blockposition)) {
diff --git a/patches/server/0810-Do-not-accept-invalid-client-settings.patch b/patches/server/0810-Do-not-accept-invalid-client-settings.patch
index fa8d84dc35..443d50fb31 100644
--- a/patches/server/0810-Do-not-accept-invalid-client-settings.patch
+++ b/patches/server/0810-Do-not-accept-invalid-client-settings.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index aa3926339c698038560f3eb2671917c9d5882fee..ba86bc53af2e9574a4fbaaf052df4f4cc5d752bd 100644
+index bea158416ed6c13db633efb742153f7813df5540..616ea3055c854872fbb5754bdf0b67deac1b4b58 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -3312,6 +3312,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3311,6 +3311,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@Override
public void handleClientInformation(ServerboundClientInformationPacket packet) {
PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel());
diff --git a/patches/server/0901-Improve-logging-and-errors.patch b/patches/server/0901-Improve-logging-and-errors.patch
index e5f0dc8f80..c5aba4a44f 100644
--- a/patches/server/0901-Improve-logging-and-errors.patch
+++ b/patches/server/0901-Improve-logging-and-errors.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Improve logging and errors
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index 9372f2363b13dca1b5ae77a509daaec7fbbf5e4f..647069b24b16aaa5f9b77a32932d8b072343331c 100644
+index 1ca01bd97068509e050485ffaddd7583563a29b8..56daa503f4471cbe2934ac554db1e0c56ecabff3 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -3386,7 +3386,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3385,7 +3385,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator));
} catch (ProfilePublicKey.ValidationException profilepublickey_b) {
diff --git a/patches/server/0910-Use-single-player-info-update-packet-on-join.patch b/patches/server/0910-Use-single-player-info-update-packet-on-join.patch
index 3df8f607ee..a42843df0e 100644
--- a/patches/server/0910-Use-single-player-info-update-packet-on-join.patch
+++ b/patches/server/0910-Use-single-player-info-update-packet-on-join.patch
@@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index cb12c626db3bdc021895cbfb3fab749a0ef5079f..a352011eff0d7c29a349345ce7426ef4f22f404b 100644
+index 95a643bcd8d43b877e1496068c38ccc7f247924e..bbb42a372d314621221688d8d5d6f418e45f4e08 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-@@ -3416,7 +3416,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3415,7 +3415,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID());
this.chatMessageChain.append((executor) -> {
this.player.setChatSession(session);
diff --git a/patches/server/0932-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0932-Prevent-causing-expired-keys-from-impacting-new-join.patch
index 8de436fbe0..a13ddb0b4f 100644
--- a/patches/server/0932-Prevent-causing-expired-keys-from-impacting-new-join.patch
+++ b/patches/server/0932-Prevent-causing-expired-keys-from-impacting-new-join.patch
@@ -24,7 +24,7 @@ index 40ac5cf19934207f06755fbea02d4626d7aa0511..32e3f347e2e025e2675e9410116386e4
UPDATE_GAME_MODE((serialized, buf) -> {
serialized.gameMode = GameType.byId(buf.readVarInt());
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
-index acc717c59ccab1102f3e12be67438998fcda6457..afbc246a2dc55f0f1576c0468118ef80671a034e 100644
+index f70ab11877ae04a4c9cc4ef61dc6e07c0f3fe9f2..93d84ca1d132222c8daed9d2683bf72f95dbb078 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -284,6 +284,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
@@ -49,7 +49,7 @@ index acc717c59ccab1102f3e12be67438998fcda6457..afbc246a2dc55f0f1576c0468118ef80
}
public void resetPosition() {
-@@ -3414,6 +3422,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
+@@ -3413,6 +3421,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
private void resetPlayerChatState(RemoteChatSession session) {
this.chatSession = session;