Scissors/patches/server/0034-Fixes-out-of-bounds-HangingEntity-crash-exploit.patch
Video 1cd49aebf7 Serious bugfix
Server patch \#34 introduced a server-crashing bug where you could crash a Scissors 1.17.1 server simply by
going near the world border.This commit removes that original patch and re-implements part of what the
patch set out to do separately so that the painting crash exploit doesn't work, but the server won't crash
when you try to go near the world border.
2022-08-19 01:02:42 -06:00

24 lines
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Video <videogamesm12@gmail.com>
Date: Fri, 19 Aug 2022 00:49:38 -0600
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 ca9decf85dd1af0baf0d34a48aa67cbb9f4eb586..50cbd324b87300d6b872581571fa97ad9fa54396 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/HangingEntity.java
@@ -265,7 +265,11 @@ public abstract class HangingEntity extends Entity {
@Override
public void readAdditionalSaveData(CompoundTag nbt) {
- this.pos = 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
+ BlockPos pos = new BlockPos(nbt.getInt("TileX"), nbt.getInt("TileY"), nbt.getInt("TileZ"));
+ if (level.isLoadedAndInBounds(pos))
+ this.pos = pos;
+ // Scissors end
}
public abstract int getWidth();