mojira.dev
MC-310311

Item modifiers that reference themselves crash the game when invoked

The bug

Item modifiers can reference each other, and when this forms a cycle, the game stack-overflows and crashes.

How to reproduce

  1. Download and apply the attached data pack: [mediaInline]
    It defines an item modifier, test:test3, with the following definition:

    [
        {
            "type": "set_name",
            "name": "blah"
        },
        "test:test3"
    ]
    
  2. Run /item modify entity @s weapon test:test3

Expected result

Either the definition should fail to load, the command should fail at runtime, or the command should succeed and only change the name to blah.

Observed result

The game freezes and crashes

[media]

Notes

At load time, the game does detect this:

[10:00:32] [Worker-Main-9/WARN]: Found loot table element validation problem in {test:test2@minecraft:item_modifier}.functions[0]: test:test2 of type minecraft:item_modifier is recursively called

However, only recursive loot tables are prevented from crashing:

[10:00:06] [Server thread/WARN]: Detected infinite loop in loot tables

Linked issues

Attachments

Comments 0

No comments.

tryashtar

(Unassigned)

Confirmed

Platform HC

Important

Data Packs

26.3 Snapshot 5

26.3 Snapshot 6

Retrieved