Advanced Peripherals

Advanced Peripherals

29M Downloads

Send invalid nbt of some mod item through chatbox can cause client crash

zyxkad opened this issue ยท 2 comments

commented

Describe

Some mod will add tooltip in their items, and some of the tooltip may depends on a strict NBT parser, which means if you sending an invalid item with the show_item action through chatbox, client can crash when they hovering on the chat.

Steps to reproduce

  1. Install Sophisticated Backpacks mod, as well as AP and CC:T
  2. With a chatbox, run
    peripheral.find('chatBox').sendFormattedMessage(textutils.serialiseJSON({
    	text = 'Hover this to crash your client',
    	hoverEvent = {
    		action = 'show_item',
    		contents = {
    			id = 'sophisticatedbackpacks:backpack',
    			tag = textutils.serialiseJSON({contentsUuid={0,0,0,0}}, { nbt_style=true }),
    		},
    	},
    }))
  3. Hover on the text
  4. The game will crash

Multiplayer?

No

Version

1.20.1-0.7.38r

Minecraft, Forge and maybe other related mods versions

Minecraft 1.20.1, Forge 47.2.0, sophisticatedbackpacks-1.20.1-3.20.5

Screenshots or Videos

No response

Crashlog/log

No response

commented

The real issue is CC:T is serializing {0,0,0,0} as a NBT Tag List [0,0,0,0], but it should be serialized as NBT Integer List [I;0,0,0,0]

commented

AP probably can detect if a message will crash the client before sending it, if is then reject the message sending


or replace the show_item with an error message will be better