2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2023-07-01 20:21:13 +00:00
|
|
|
From: Video <videogamesm12@gmail.com>
|
|
|
|
Date: Sat, 12 Mar 2022 19:34:59 -0700
|
|
|
|
Subject: [PATCH] UUID validation
|
2022-07-28 03:57:50 +00:00
|
|
|
|
|
|
|
|
2023-07-01 20:21:13 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/nbt/NbtUtils.java b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
2023-10-18 22:49:54 +00:00
|
|
|
index b65dcff9812dbc3256c080ac264c4aafd83ce276..82b53a7bfb37bfa1752a016a8a454c0b994b9108 100644
|
2023-07-01 20:21:13 +00:00
|
|
|
--- a/src/main/java/net/minecraft/nbt/NbtUtils.java
|
|
|
|
+++ b/src/main/java/net/minecraft/nbt/NbtUtils.java
|
2023-10-18 22:49:54 +00:00
|
|
|
@@ -74,7 +74,11 @@ public final class NbtUtils {
|
|
|
|
UUID uUID = nbt.hasUUID("Id") ? nbt.getUUID("Id") : Util.NIL_UUID;
|
2023-07-01 20:21:13 +00:00
|
|
|
// Paper start - support string UUID's
|
2023-10-18 22:49:54 +00:00
|
|
|
if (nbt.contains("Id", Tag.TAG_STRING)) {
|
2023-07-01 20:21:13 +00:00
|
|
|
- uUID = UUID.fromString(nbt.getString("Id"));
|
|
|
|
+ // Scissors start - Validate String UUIDs in game profiles
|
|
|
|
+ try {
|
|
|
|
+ uUID = UUID.fromString(nbt.getString("Id"));
|
|
|
|
+ } catch (Exception ignored) {}
|
|
|
|
+ // Scissors end
|
|
|
|
}
|
|
|
|
// Paper end
|
2023-10-18 22:49:54 +00:00
|
|
|
String string = nbt.getString("Name");
|
2022-07-28 03:57:50 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/network/chat/HoverEvent.java b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
2022-12-11 04:28:09 +00:00
|
|
|
index 3ad05bbab726c59e7b67d9614af4b208d4520cb3..c0633f9553fb5aa52e8ffc863159521d09cb3bd5 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
|
|
+++ b/src/main/java/net/minecraft/network/chat/HoverEvent.java
|
|
|
|
@@ -174,7 +174,14 @@ public class HoverEvent {
|
|
|
|
} else {
|
|
|
|
JsonObject jsonObject = json.getAsJsonObject();
|
2022-12-11 04:28:09 +00:00
|
|
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(GsonHelper.getAsString(jsonObject, "type")));
|
2022-07-28 03:57:50 +00:00
|
|
|
- UUID uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
|
|
|
+ // Scissors start
|
|
|
|
+ UUID uUID;
|
|
|
|
+ try {
|
|
|
|
+ uUID = UUID.fromString(GsonHelper.getAsString(jsonObject, "id"));
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ // Scissors end
|
|
|
|
Component component = Component.Serializer.fromJson(jsonObject.get("name"));
|
|
|
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
|
|
|
}
|
|
|
|
@@ -186,7 +193,14 @@ public class HoverEvent {
|
|
|
|
CompoundTag compoundTag = TagParser.parseTag(text.getString());
|
|
|
|
Component component = Component.Serializer.fromJson(compoundTag.getString("name"));
|
2022-12-11 04:28:09 +00:00
|
|
|
EntityType<?> entityType = BuiltInRegistries.ENTITY_TYPE.get(new ResourceLocation(compoundTag.getString("type")));
|
2022-07-28 03:57:50 +00:00
|
|
|
- UUID uUID = UUID.fromString(compoundTag.getString("id"));
|
|
|
|
+ // Scissors start
|
|
|
|
+ UUID uUID;
|
|
|
|
+ try {
|
|
|
|
+ uUID = UUID.fromString(compoundTag.getString("id"));
|
|
|
|
+ } catch (Exception ex) {
|
|
|
|
+ return null;
|
|
|
|
+ }
|
|
|
|
+ // Scissors end
|
|
|
|
return new HoverEvent.EntityTooltipInfo(entityType, uUID, component);
|
|
|
|
} catch (Exception var5) {
|
|
|
|
return null;
|