Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
zyxkad opened this issue May 22, 2024 · 2 comments · Fixed by #619
Closed

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

zyxkad opened this issue May 22, 2024 · 2 comments · Fixed by #619
Assignees
Labels

Comments

@zyxkad
Copy link
Collaborator

zyxkad commented May 22, 2024

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

@zyxkad zyxkad added bug Something isn't working needs review Needs review from an Contributor labels May 22, 2024
@zyxkad zyxkad self-assigned this May 22, 2024
@zyxkad zyxkad removed the needs review Needs review from an Contributor label May 22, 2024
@zyxkad
Copy link
Collaborator Author

zyxkad commented May 22, 2024

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]

@zyxkad
Copy link
Collaborator Author

zyxkad commented May 22, 2024

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

@zyxkad zyxkad mentioned this issue May 22, 2024
3 tasks
@zyxkad zyxkad linked a pull request May 22, 2024 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants