ViaVersion / ViaFabric

Client-side and server-side ViaVersion implementation for Fabric
https://viaversion.com/fabric
GNU General Public License v3.0
323 stars 39 forks source link

DataFormatException with large system chat packets [1.20.4 -> 1.19.4] #324

Closed Xenapte closed 4 months ago

Xenapte commented 5 months ago

/viaversion dump Output

https://dump.viaversion.com/1b809d682ac2e7b51102c66a0fe2a124a43be563ecc606bf06843fd147894500

Console Error

https://mclo.gs/aihPUyW

Yes, I know this is a bit long because it contains the entire data of that large packet.

Bug Description

Some servers have plugins that allow arbitrary item to be displayed as a weapon in death messages. Killing players with an item that has a large NBT data size causes players running ViaFabric to disconnect with the DataFormatException.

Steps to Reproduce

  1. Set up a 1.19.4 server with plugins/mods that show any arbitrary item as weapon on death (e.g. PurpurMC with the config of player-deaths-always-show-item: true)
  2. Log in on a 1.20.4 client with ViaFabric installed
  3. Fill a shulker box with around 80 KB of data using books (my logs contain the NBT data of the exact shulker box that was used to generate the exception) - don't make it too long or nothing about its data will be sent to the client.
  4. Use the shulker box to kill some player.

Expected Behavior

The death message is displayed correctly with the shulker box as the weapon item.

Additional Server Info

Kick screen.

Checklist

kreivon commented 5 months ago

Running into the same issue with ViaFabricPlus.

Kichura commented 5 months ago

Closing this issue as OP has outdated ViaVersion, if you can reproduce this with latest viafabric + viaversion jars combined then make a reply and it will be reopened.

Xenapte commented 5 months ago

Can confirm this still exists with the latest viafabric-0.4.14+68-main. In fact, trying to paste the command to summon that huge NBT data item into a command block causes a kick too, for the server sends the full command as feedback.

New viaversion dump: https://dump.viaversion.com/1b809d682ac2e7b51102c66a0fe2a124a43be563ecc606bf06843fd147894500 (I'll update the link in the issue report itself too)

Command used to summon the item: https://mclo.gs/pAvfoZk

FlorianMichael commented 4 months ago

Same as https://github.com/ViaVersion/ViaVersion/blob/2d41eb52a6692e7552242091d749c3058d99f9e9/common/src/main/java/com/viaversion/viaversion/util/ComponentUtil.java#L78, seems to be down to ViaNBT not handling something Vanilla does

FlorianMichael commented 4 months ago

Fixed with https://github.com/ViaVersion/ViaVersion/commit/af393c564f20f40f14d276e8e209bd625a6c24d8