Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-15 04:20:04 +01:00
Merge pull request #155 from DemonWav/otherBlockPosFix
Add same infi-loop fix to other identical block of code I missed earlier
Dieser Commit ist enthalten in:
Commit
b14b3b8803
@ -1,11 +1,11 @@
|
||||
From 74052653db4261320e163b29c7d7e526cb0f5d99 Mon Sep 17 00:00:00 2001
|
||||
From 6ab6d576f6c1a3ab8eedff24e7d4f0181e5575d5 Mon Sep 17 00:00:00 2001
|
||||
From: DemonWav <demonwav@gmail.com>
|
||||
Date: Sat, 26 Mar 2016 21:36:05 -0500
|
||||
Subject: [PATCH] Prevent possible infinite loop in BlockPosition iterator
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
index 2d56f02..84e862b 100644
|
||||
index 2d56f02..b87c4c6 100644
|
||||
--- a/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
+++ b/src/main/java/net/minecraft/server/BlockPosition.java
|
||||
@@ -139,15 +139,17 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
@ -47,6 +47,45 @@ index 2d56f02..84e862b 100644
|
||||
|
||||
this.b = new BlockPosition(i, j, k);
|
||||
return this.b;
|
||||
@@ -187,15 +201,17 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
|
||||
protected BlockPosition.MutableBlockPosition a() {
|
||||
if (this.b == null) {
|
||||
- this.b = new BlockPosition.MutableBlockPosition(blockposition.getX(), blockposition.getY(), blockposition.getZ());
|
||||
+ this.b = new BlockPosition.MutableBlockPosition(blockposition2.getX(), blockposition2.getY(), blockposition2.getZ()); // Paper - use blockposition2 instead of blockposition to prevent infinite loops
|
||||
return this.b;
|
||||
- } else if (this.b.equals(blockposition1)) {
|
||||
+ } else if (this.b.equals(blockposition3)) { // Paper - use blockposition3 instead of blockposition1 to prevent infinite loops
|
||||
return (BlockPosition.MutableBlockPosition) this.endOfData();
|
||||
} else {
|
||||
int i = this.b.getX();
|
||||
int j = this.b.getY();
|
||||
int k = this.b.getZ();
|
||||
|
||||
+ // Paper start - use blockposition2 and blockposition3 to prevent infinite loops
|
||||
+ /*
|
||||
if (i < blockposition1.getX()) {
|
||||
++i;
|
||||
} else if (j < blockposition1.getY()) {
|
||||
@@ -206,6 +222,18 @@ public class BlockPosition extends BaseBlockPosition {
|
||||
j = blockposition.getY();
|
||||
++k;
|
||||
}
|
||||
+ */
|
||||
+ if (i < blockposition3.getX()) {
|
||||
+ ++i;
|
||||
+ } else if (j < blockposition3.getY()) {
|
||||
+ i = blockposition2.getX();
|
||||
+ ++j;
|
||||
+ } else if (k < blockposition3.getZ()) {
|
||||
+ i = blockposition2.getX();
|
||||
+ j = blockposition2.getY();
|
||||
+ ++k;
|
||||
+ }
|
||||
+ // Paper end
|
||||
|
||||
// Paper start - modify base position variables
|
||||
((BaseBlockPosition) this.b).a = i;
|
||||
--
|
||||
2.7.4
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren