mojira.dev
MC-271001

Items in a container can be given a count above 99 (to max integer), and can crash the world

Using the following give command, item stacks can be given extremely high counts up to the java max integer.

/give @s barrel[container=[{slot:0,item:{id:wooden_sword,count:2147483647}}]]

Placing and then breaking the barrel will cause the stack to split into smaller stacks, spawn at least a few hundred million item entities, and crash the world. The split stacks seem to have random counts around 10 to 30, so it's slightly less than 2 billion entities spawned at once.

Using commands to get an item with max_stack_size above 99 will detect and remove the invalid component, and setting the item count to below 1 will set it back to 1. Expected behavior would be for item count to be limited to the max_stack_size (or at least a hard coded max of 99).

Comments 1

Can confirm, An error was produced in the log after force quitting the game:
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "Download-2"

42Richtofen42

etanaratsastaja

Confirmed

Platform

Very Important

Crash

1.20.5 Pre-Release 1, 1.20.5 Release Candidate 2, 1.20.6

24w19a

Retrieved