mojira.dev
MC-308157

The game crashes when an evoker retaliates against a vex that has itself as its owner

Steps to Reproduce:
1) Open a new world (important because you cannot access the this world afterwards)
2) Run

/summon vex ~ ~ ~ {UUID:[I;0,0,0,0],NoAI:1b,owner:[I;0,0,0,0]}

3) Summon an Evoker
4) Run

/damage @e[type=evoker,limit=1,sort=nearest] 0 minecraft:arrow by 00000000-0000-0000-0000-000000000000

5) java.lang.StackOverflowError crash and the world is unplayable

Note:
This works with any ownership cycle, for example:
Suppose Vex A is owned by Vex B and Vex B is owned by Vex A
Then if either Vex hurts the Evoker, a crash occurs

Code Analysis: (from Evoker.java)

protected boolean considersEntityAsAlly(final Entity other) {
    if (other == this) {
        return true;
    } else if (super.considersEntityAsAlly(other)) {
        return true;
    } else {
        if (other instanceof Vex) {
            Vex vex = (Vex) other;
            if (vex.getOwner() != null) {
                return this.considersEntityAsAlly(vex.getOwner());
            }
        }

        return false;
    }
}

You can see that this code will recursively check the Vex’s owner to determine whether the Evoker should fight back against the Vex but the code doesn’t consider a Vex owning itself (or checking if any cycle has been traversed at all) which results in constantly calling the method and then the crash

Comments 0

No comments.

Shuddery

Nathan Wolf

Confirmed

Platform

Normal

Commands, Crash

26.1.2

26.2 Pre-Release 1

Retrieved