From a406f34921995b0dbb0f9936968fc3d90c46fe70 Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Tue, 12 Apr 2016 23:08:55 -0500 Subject: [PATCH] Only allow non-zero value maxDistances for BlockIterators Prevents them from iterating infinitely and hanging the server --- ...-non-zero-maxDistance-BlockIterators.patch | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Spigot-API-Patches/0036-Only-allow-non-zero-maxDistance-BlockIterators.patch diff --git a/Spigot-API-Patches/0036-Only-allow-non-zero-maxDistance-BlockIterators.patch b/Spigot-API-Patches/0036-Only-allow-non-zero-maxDistance-BlockIterators.patch new file mode 100644 index 0000000000..15def6ba09 --- /dev/null +++ b/Spigot-API-Patches/0036-Only-allow-non-zero-maxDistance-BlockIterators.patch @@ -0,0 +1,23 @@ +From 74c1e1dfd8eaaa86e68838b823ebd5177f007066 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 12 Apr 2016 23:06:56 -0500 +Subject: [PATCH] Only allow non-zero maxDistance BlockIterators + +They can iterate infinitely causing the server to hang. +Fix your plugins! + +diff --git a/src/main/java/org/bukkit/util/BlockIterator.java b/src/main/java/org/bukkit/util/BlockIterator.java +index 5c85778..0f34c66 100644 +--- a/src/main/java/org/bukkit/util/BlockIterator.java ++++ b/src/main/java/org/bukkit/util/BlockIterator.java +@@ -52,6 +52,7 @@ public class BlockIterator implements Iterator { + * + */ + public BlockIterator(World world, Vector start, Vector direction, double yOffset, int maxDistance) { ++ com.google.common.base.Preconditions.checkArgument(maxDistance != 0, "maxDistance cannot be 0!"); // Paper - Only allow non-zero maxDistance + this.world = world; + this.maxDistance = maxDistance; + +-- +2.8.0 +