Skip to content

Commit

Permalink
Add another slot sanity check
Browse files Browse the repository at this point in the history
  • Loading branch information
kennytv committed Nov 3, 2023
1 parent 0b21890 commit 8493340
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Subject: [PATCH] Add slot sanity checks in container clicks


diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..2047224f26bf6c6aa125c15a14fe91d81e5b76ba 100644
index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..5d298b11f74cd2da47e6613ced621ab62aa73a7b 100644
--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
+++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java
@@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu {
Expand All @@ -20,7 +20,7 @@ index 3ef712299fe248602b0b117c0a8e285cdf4e05c2..2047224f26bf6c6aa125c15a14fe91d8
int j2;

if (actionType == ClickType.SWAP) {
+ if (slotIndex < 0) return; // Paper
+ if (slotIndex < 0 || button < 0) return; // Paper
slot2 = (Slot) this.slots.get(slotIndex);
itemstack1 = playerinventory.getItem(button);
itemstack = slot2.getItem();

3 comments on commit 8493340

@Xayanix
Copy link

@Xayanix Xayanix commented on 8493340 Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this related to recent exploit to abuse containers to lag server?
If yes, then should've fixed this instead:

image

Crash report causing excessive cpu usage

@Xayanix
Copy link

@Xayanix Xayanix commented on 8493340 Nov 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(rest)
image

@lynxplay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments on commits are probably the worst place to put any form of feedback, please refrain from doing so in the future.
Crash reports are obviously expensive as they have to collect a lot of system data for a potential analysis of a crash.
They should not happen in the first place.

Please either open an issue or, preferably, take this to our discord if you have any more feedback.

Please sign in to comment.