mojira.dev
MC-267103

Client crashes when receiving inconsistent network registries

The network registries compose the data that is sent to the client via ClientboundRegistryDataPacket during the configuration phase, the six of them being:

  • minecraft:trim_material

  • minecraft:trim_pattern

  • minecraft:worldgen/biome

  • minecraft:chat_type

  • minecraft:damage_type

  • minecraft:dimension_type

There are currently three issues with how they are handled on the client, all of them causing it to crash. They are as follows:

Server not sending all the required registries

The client will attempt to access every one of the six registries, regardless if they were sent by the server or not. If the registry wasn't sent by the server, the client crashes:

[media]

Server not sending all the required registry entries

For the minecraft:worldgen/biome and minecraft:damage_type registries, the client expects specific entries to be present, and will try to access them whether they are or not. If they weren't sent by the server, the client crashes.

For minecraft:worldgen/biome, it is the entry by the name of minecraft:plains.

[media]

For minecraft:damage_type, they are the entries accessed in the constructor of DamageSources, or the entries by the names of:

  • minecraft:in_fire

  • minecraft:lightning_bolt

  • minecraft:on_fire

  • minecraft:lava

  • minecraft:hot_floor

  • minecraft:in_wall

  • minecraft:cramming

  • minecraft:drown

  • minecraft:starve

  • minecraft:cactus

  • minecraft:fall

  • minecraft:fly_into_wall

  • minecraft:out_of_world

  • minecraft:generic

  • minecraft:magic

  • minecraft:wither

  • minecraft:dragon_breath

  • minecraft:dry_out

  • minecraft:sweet_berry_bush

  • minecraft:freeze

  • minecraft:stalagmite

  • minecraft:outside_border

  • minecraft:generic_kill

[media]

Server sending references to non-existent registry entries

The entries for the minecraft:worldgen/biome, minecraft:damage_type and minecraft:dimension_type registries are referenced in other parts of the protocol, namely the following packets:

  • ClientboundChunksBiomesPacket and ClientboundLevelChunkWithLightPacket for biomes

  • ClientboundDamageEventPacket for damage types

  • ClientboundLoginPacket and ClientboundRespawnPacket for dimension types

If an entry that isn't present in the network registries is referenced in any of the packets above, the client will crash upon receiving said packet:

[media]

[media]

[media]

Conversely, a similar situation happens with the minecraft:chat_type registry and both ClientboundDisguisedChatPacket and ClientboundPlayerChatPacket packets. However, the client instead disconnects gracefully from the server with a multiplayer.disconnect.invalid_packet message instead of hard crashing, which was perhaps the intended behavior for the others?

[media]

As far as I am aware, these situations will never happen with the Vanilla server, but only with a modded one where the registries have been specifically crafted. It does however, always affect and crash the Vanilla client regardless.

Attachments

Comments 4

From how it's described, it seems possible to reproduce this with a data pack that disables said registries (via the block list in pack.mcmeta).
Might want to check that.

Perhaps a good idea to note which IDs have to exist.

Made the issue more generalized, tackling two closely related problems regarding the network registries.

Added the crash-logs for each case. They could be relevant as the crashes were triggered in six distinct parts of the code.

I am no longer able to reproduce any of the crashes as of 1.20.5-pre2. All the scenarios described in this issue now lead to a client disconnect with either a Failed to decode packet '<packet>' (during packet decoding) or disconnect.packetError (during packet processing) message.

WinX64

(Unassigned)

Plausible

Platform

Normal

Crash, Networking

1.20.3 Pre-Release 4

1.20.5 Pre-Release 2

Retrieved