Scissors/patches/server/0033-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch
allinkdev 871cc5653c
Clean up patches (#103)
* Clean up command block event patch

* Merge resource location patches

* Merge map decoration patches

* Merge Video's resource location patches

* Merge large tag reset patches
2023-06-16 22:54:59 -05:00

25 lines
1.3 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Telesphoreo <me@telesphoreo.me>
Date: Mon, 22 Aug 2022 21:33:37 -0500
Subject: [PATCH] Fixes out of bounds HangingEntity crash exploit
diff --git a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
index 66cf0a6cd1525ecf2615809210a26d55f445d07d..74fb79d4ea11f88f2c0de65b492a5fecc49684f1 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -270,6 +270,13 @@ public abstract class HangingEntity extends Entity {
public void readAdditionalSaveData(CompoundTag nbt) {
BlockPos blockposition = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
+ // Scissors start - Fixes exploit where bad TileX, TileY, and TileZ coordinates can crash servers
+ if (level().isLoadedAndInBounds(blockposition))
+ {
+ this.pos = blockposition;
+ }
+ // Scissors end
+
if (!blockposition.closerThan(this.blockPosition(), 16.0D)) {
HangingEntity.LOGGER.error("Hanging entity at invalid position: {}", blockposition);
} else {