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

/data modify can create corrupt NBT lists (crashes)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Minecraft 19w03a
    • Minecraft 18w50a
    • None
    • Confirmed

      The bug

      /data modify can create the following corrupt NBT lists:

      • List that contains values of differing types (this can crash the game and corrupt the save)
      • Empty list that only accepts values of a certain type

      How to reproduce (1)

      1. Create a list in an NBT-safe place (item tag tag).
        /setblock ~ ~ ~ chest{Items:[{id:tnt,Count:1b,tag:{custom_list:[1,2,3]}}]}
      2. Replace a value with one of a differing type.
        /data modify block ~ ~ ~ Items[0].tag.custom_list[0] set value 5b
      3. The list now contains values of differing types, which is otherwise impossible. The game will use the original type for determining what can be appended to the list until the game saves, after which it will use the type of the first item.
      4. Save your game and reopen it.
         Loading the corrupt invalid list crashes the game: crash.txt.

      How to reproduce (2)

      1. Create a list in an NBT-safe place (item tag tag).
        /setblock ~ ~ ~ chest{Items:[{id:tnt,Count:1b,tag:{custom_list:[1]}}]}
      2. Remove the only item.
        /data remove block ~ ~ ~ Items[0].tag.custom_list[0]
      3. The list is now empty, but is in an invalid state. Empty lists should be able to accept any value, but this list will only be able to accept values of the original type.
        /data modify block ~ ~ ~ Items[0].tag.custom_list append value "string"
        

         This command will fail until the game autosaves. When the game saves, this invalid state is corrected.

            boq [Mojang] Bartosz Bok
            tryashtar [Mod] tryashtar
            Votes:
            4 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: