Mojira Archive
MC-248768

Dispensing an Axolotl Bucket with an invalid variant crashes the game

The bug

The game doesn't properly validate whether or not a variant number defined for Axolotl Buckets is actually one that is in-bounds, so when it tries to spawn the Axolotl, it fails with an ArrayIndexOutOfBoundsException. This causes the game to instantly crash.

Methods to reproduce

  1. Give yourself the Axolotl Bucket containing the broken value with this command:
    /give @p minecraft:axolotl_bucket{Age:0,FromBucket:1b,Health:14.0f,Variant:2147483646}
    
  2. Put it in a dispenser
  3. Activate the dispenser

Stack trace

Description: Exception ticking world

java.lang.ArrayIndexOutOfBoundsException: Index 2147483646 out of bounds for length 5
	at bin.c(SourceFile:446)
	at bun.a(SourceFile:55)
	at bun.a(SourceFile:40)
	at hj$8.a(SourceFile:380)
	at hi.dispense(SourceFile:15)
	at cet.a(SourceFile:90)
	at cet.a(SourceFile:113)
	at cob$a.a(SourceFile:917)
	at adi.d(SourceFile:688)
	at dpt.a(SourceFile:215)
	at dpt.a(SourceFile:98)
	at adi.a(SourceFile:298)
	at net.minecraft.server.MinecraftServer.b(SourceFile:879)
	at net.minecraft.server.MinecraftServer.a(SourceFile:823)
	at fcv.a(SourceFile:99)
	at net.minecraft.server.MinecraftServer.w(SourceFile:684)
	at net.minecraft.server.MinecraftServer.a(SourceFile:270)
	at java.base/java.lang.Thread.run(Thread.java:833)

Fixed

_Video

[Mojang] slicedlime

2022-02-22, 10:18 PM

2022-02-23, 02:15 PM

2022-02-23, 02:15 PM

1

2

Confirmed

Very Important

Crash

axolotl, bucket, crash, dispenser

1.18.1, 1.18.2 Pre-release 2

1.18.2 Pre-release 3