From 2c0075031c4f9e56e04502950442b6794e97bbfe Mon Sep 17 00:00:00 2001 From: Aikar Date: Mon, 19 Dec 2016 23:39:52 -0500 Subject: [PATCH] Ignore invalid Marker Icon ID's in maps - Fixes #497 Replace with the red marker. Should of only happened by creative abuse. --- ...ore-invalid-Marker-Icon-ID-s-in-maps.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Spigot-Server-Patches/0187-Ignore-invalid-Marker-Icon-ID-s-in-maps.patch diff --git a/Spigot-Server-Patches/0187-Ignore-invalid-Marker-Icon-ID-s-in-maps.patch b/Spigot-Server-Patches/0187-Ignore-invalid-Marker-Icon-ID-s-in-maps.patch new file mode 100644 index 000000000..5599a2102 --- /dev/null +++ b/Spigot-Server-Patches/0187-Ignore-invalid-Marker-Icon-ID-s-in-maps.patch @@ -0,0 +1,27 @@ +From 3a254afb4fdeca00e5807e50eea6384e76969546 Mon Sep 17 00:00:00 2001 +From: Aikar +Date: Mon, 19 Dec 2016 23:38:57 -0500 +Subject: [PATCH] Ignore invalid Marker Icon ID's in maps + +Replace with the red marker. Should of only happened by creative abuse. + +diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java +index dbe6a80f2..dfd8e4d84 100644 +--- a/src/main/java/net/minecraft/server/WorldMap.java ++++ b/src/main/java/net/minecraft/server/WorldMap.java +@@ -194,7 +194,11 @@ public class WorldMap extends PersistentBase { + // Spigot - start + UUID uuid = UUID.nameUUIDFromBytes(nbttagcompound.getString("id").getBytes(Charsets.US_ASCII)); + if (!this.decorations.containsKey(uuid)) { +- this.a(MapIcon.Type.a(nbttagcompound.getByte("type")), entityhuman.world, uuid, nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot")); ++ // Paper start - protect against bad map icon indexes ++ byte iconId = nbttagcompound.getByte("type"); ++ MapIcon.Type[] values = MapIcon.Type.values(); ++ this.a(values.length > iconId ? values[iconId] : values[2], entityhuman.world, uuid, nbttagcompound.getDouble("x"), nbttagcompound.getDouble("z"), nbttagcompound.getDouble("rot")); ++ // Paper end + // Spigot - end + } + } +-- +2.11.0 +