Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-272627

Leash holder UUID is unchecked during NBT deserialization

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • None
    • 1.20.6, 1.21 Pre-Release 1, 1.21 Pre-Release 2, 1.21, 24w34a, 24w36a, 24w39a, 24w40a, 24w45a, 25w02a
    • None
    • Confirmed
    • Commands
    • Low
    • 1245091
    • Platform

      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.

            Unassigned Unassigned
            haykam haykam
            Votes:
            3 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              CHK: