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

/data modify can create corrupt NBT lists (crashes)

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Resolution: Fixed
    • Affects Version/s: Minecraft 18w50a
    • Fix Version/s: Minecraft 19w03a
    • Labels:
      None
    • Confirmation Status:
      Confirmed

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  CHK: