The bug
When a String whose encoded length is larger than 32767 bytes should be written to a PacketBuffer
the message in the exception uses the length of the String instead of the length of the byte array. This results in exceptions like "String too big (was 16000 bytes encoded, max 32767)".
net.minecraft.network.PacketBuffer.writeString(String) (MCP 9.30, Minecraft 1.10)
public PacketBuffer writeString(String string)
{
byte[] abyte = string.getBytes(Charsets.UTF_8);
if (abyte.length > 32767)
{
// Replaced this, uses abyte.length instead of string.length()
//throw new EncoderException("String too big (was " + string.length() + " bytes encoded, max " + 32767 + ")");
throw new EncoderException("String too big (was " + abyte.length + " bytes encoded, max " + 32767 + ")");
}
else
{
this.writeVarIntToBuffer(abyte.length);
this.writeBytes(abyte);
return this;
}
}
How to reproduce
See MC-68458
Linked issues
Comments 0
No comments.