mojira.dev
MC-312715

The game crashes when a jukebox in a playlist has a negative `playlist_position` value

The Bug:

The game crashes when a jukebox in a playlist has a negative playlist_position value.

Steps to Reproduce:

  1. Place down a jukebox with a negative playlist_position value by using the command provided below.

    /setblock ~ ~ ~2 minecraft:jukebox{playlist_position:-10}
  2. Place down a chest on top of the jukebox by using the command provided below.

    /setblock ~ ~1 ~2 minecraft:chest
  3. Observe if the game crashes.

Observed Behavior:

The game crashes.

Expected Behavior:

The game would not crash.

Attachments

Comments 1

JukeboxBlockEntity#findNextPlayListPosition is calculating the next slot with (startPosition + offset) % container.getContainerSize()

When you pass playlist_position: -10, container.getItem(-9) throws the exception shown in the crash report. loadAdditional also accepts the stored position without checking its range.

Need to add a validation check here when the value is loaded.

Avoma

(Unassigned)

Unconfirmed

Crash

26.4 Snapshot 4

Retrieved