
Item tooltips in chat messages are improperly translated sometimes
eclipseisoffline opened this issue ยท 0 comments
Polymer seems to incorrectly translate item tooltips in chat messages in specific conditions, causing everyone who receives the chat message to be disconnected.
This bug has been reproduced with the most recent Polymer version, 0.9.5, on Minecraft 1.21.
To reproduce, setup a Fabric 1.21 server with Polymer 0.9.5 and a Polymer mod such as universal shops, and give yourself a Polymer item with a custom name, like so:
/give @s universal_shops:trade_block[minecraft:custom_name='"test"']
You will then most likely disconnect from the server, because Minecraft failed to read the chat message the command sends, because it contains an untranslated Polymer item. This can be seen in the crash log Minecraft provided:
---- Minecraft Network Protocol Error Report ----
// Could be worse, I guess
Time: 2024-07-17 09:22:57
Description: Packet handling error
io.netty.handler.codec.DecoderException: Failed to decode packet 'clientbound/minecraft:system_chat'
at yw.a(SourceFile:38)
at yw.decode(SourceFile:14)
at wd.decode(SourceFile:31)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:529)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:468)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:290)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.flow.FlowControlHandler.dequeue(FlowControlHandler.java:202)
at io.netty.handler.flow.FlowControlHandler.channelRead(FlowControlHandler.java:164)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:442)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:800)
at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:509)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:407)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: io.netty.handler.codec.DecoderException: Failed to decode: Failed to parse either. First: Failed to parse either. First: Not a string; Second: Not a list:
{fallback:"commands.give.success.single",translate:"commands.give.success.single",with:[{"":1},{color:"white",fallback:"chat.square_brackets",hoverEvent:{action:"show_item",contents:{components:{"minecraft:custom_name":'"test"'},count:1,id:"universal_shops:trade_block"}},translate:"chat.square_brackets",with:[{extra:["test"],italic:1b,text:""}]},{clickEvent:{action:"suggest_command",value:"/tell Player "},hoverEvent:{action:"show_entity",contents:{id:[I;734085486,1012877227,-1868941507,-1453256805],name:"Player",type:"minecraft:player"}},insertion:"Player",text:"Player"}]}
Second: No matching codec found
{fallback:"commands.give.success.single",translate:"commands.give.success.single",with:[{"":1},{color:"white",fallback:"chat.square_brackets",hoverEvent:{action:"show_item",contents:{components:{"minecraft:custom_name":'"test"'},count:1,id:"universal_shops:trade_block"}},translate:"chat.square_brackets",with:[{extra:["test"],italic:1b,text:""}]},{clickEvent:{action:"suggest_command",value:"/tell Player "},hoverEvent:{action:"show_entity",contents:{id:[I;734085486,1012877227,-1868941507,-1453256805],name:"Player",type:"minecraft:player"}},insertion:"Player",text:"Player"}]}
at yv$6.a(SourceFile:273)
at com.mojang.serialization.DataResult$Error.getOrThrow(DataResult.java:287)
at yv$6.a(SourceFile:273)
at yv$6.decode(SourceFile:268)
at yx$12.decode(SourceFile:149)
at yx$9.a(SourceFile:91)
at yx$9.decode(SourceFile:87)
at yw.a(SourceFile:36)
... 41 more
Note that the crash log has been slightly modified to redact my player name and UUID. This bug has also occurred with death messages containing custom items, causing everyone on the server (everyone who receives the death message) to disconnect, which could potentially be exploited.