Mojira Archive
MC-272627

Leash holder UUID is unchecked during NBT deserialization

When running the following command (or a similar command with a UUID that is not a valid integer array), an exception will be thrown and an "Unable to summon entity" error will be sent:

/summon minecraft:cow ~ ~ ~ {leash: {UUID: 1}}

This is equivalent to the following spawn egg, which fails to spawn a cow and prints an exception to the log:

/give @s minecraft:cow_spawn_egg[minecraft:entity_data={id: cow, leash: {UUID: 1}}]

Code analysis (Yarn mappings)

The NbtCompound#containsUuid method validates that a given key has a valid UUID value before the NbtCompound#getUuid method, which throws an exception for invalid UUIDs, is called. In all other cases of NBT deserialization, these methods work in tandem.

However, the Leashable#readLeashDataFromNbt only calls the NbtCompound#getUuid method. Therefore, it will throw an exception for invalid UUIDs.

Unresolved

haykam

2024-05-30, 06:40 AM

2025-01-10, 08:15 PM

3

3

Confirmed

Low

1245091

Platform

Commands

1.20.6 - 25w02a1.20.6, 1.21 Pre-Release 1, 1.21 Pre-Release 2, 1.21, 24w34a, 24w36a, 24w39a, 24w40a, 24w45a, 25w02a

-