Archiviert
13
0
Dieses Repository wurde am 2024-12-25 archiviert. Du kannst Dateien ansehen und es klonen, aber nicht pushen oder Issues/Pull-Requests öffnen.
Paper-Old/patches/server/0850-Fix-int-overflow-in-chunk-range-check.patch
Noah van der Aa 2e99e5e677
Updated Upstream (Bukkit/CraftBukkit) (#7411)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
af88996a SPIGOT-6890: Add repair cost amount in AnvilInventory
bc7bd363 PR-716: Fix scheduler javadocs (previously, the <b> tag broke the rendering)
6db1ab70 Improve item cooldown JavaDocs

CraftBukkit Changes:
13670b44 SPIGOT-6890: Add repair cost amount in AnvilInventory
0d109e86 PR-999: Prevent non-item cooldowns
2022-01-27 15:35:36 +01:00

26 Zeilen
1.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nassim Jahnke <jahnke.nassim@gmail.com>
Date: Tue, 11 Jan 2022 19:31:46 +0100
Subject: [PATCH] Fix int overflow in chunk range check
diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java
index 387b0e9b862621e7d0c1179f348e07c25f1ee9c0..2e6e86439173ebdb13b9cebd1e266e91335c1e2d 100644
--- a/src/main/java/net/minecraft/server/level/ChunkMap.java
+++ b/src/main/java/net/minecraft/server/level/ChunkMap.java
@@ -621,9 +621,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider
public static boolean isChunkInRange(int x1, int z1, int x2, int z2, int distance) {
int j1 = Math.max(0, Math.abs(x1 - x2) - 1);
int k1 = Math.max(0, Math.abs(z1 - z2) - 1);
- int l1 = Math.max(0, Math.max(j1, k1) - 1);
- int i2 = Math.min(j1, k1);
- int j2 = i2 * i2 + l1 * l1;
+ // Paper start - fix integer overflow
+ long l1 = Math.max(0, Math.max(j1, k1) - 1);
+ long i2 = Math.min(j1, k1);
+ long j2 = i2 * i2 + l1 * l1;
+ // Paper end
int k2 = distance - 1;
int l2 = k2 * k2;