mojira.dev
MC-279838

CustomPacketPayload size is only checked in DiscardedPayload

The message of the IllegalArgumentException in DiscardedPayload is the following:

"Payload may not be larger than" + maxBytes + " bytes"

From this error message I assume that the check only being present in DiscardedPayload is a bug.

Comments 3

What are the gameplay effects? Can this issue be reproduced in the game?

What are the gameplay effects? Can this issue be reproduced in the game?

There are no major gameplay effects as far as I know.
Yes, this can be reproduced with the following steps: 

Prerequisites/Assumptions:

  • connected to a server (it can be an integrated server)

  • the client and server are both in ConnectionProtocol.PLAY

1. Create a String named "s" with the following data:

// longer than ServerboundCustomPayloadPacket.MAX_PAYLOAD_SIZE when encoded
String s = "\u2603".repeat(FriendlyByteBuf.MAX_STRING_LENGTH);

2. Send a payload with the following arguments:

  • channel: "minecraft:brand"

  • data: FriendlyByteBuf.writeUTF(s);

3. Send another payload with the following arguments (if possible):

  • channel: "this_channel_could_be:any_other_unregistered_channel"

  • data: FriendlyByteBuf.writeUTF(s);

Observed Behavior:
The first payload gets accepted without any problems, the second one makes the server throw a DecoderException caused by an IllegalArgumentException whose message is in the description of this bug report.

Expected Behaviors:

  • The server throws a DecoderException for the first payload too because the payload is too long.

  • The first payload gets accepted without any problems, the second one makes the server throw a DecoderException caused by an IllegalArgumentException with another message because the current one is a little misleading.

Thank you for your report!
After consideration, the issue is being closed as Invalid.

This report does not describe a bug.

Quick Links:
📓 Bug Tracker Guidelines – 💬 Community Support – 📧 Mojang Support (Technical Issues) – 📧 Microsoft Support (Account Issues)
📓 Project Summary – ✍️ Feedback and Suggestions – 📖 Game Wiki

0x06

(Unassigned)

Plausible

(Unassigned)

1.21.4, 25w04a, 25w05a

Retrieved