Validate uncompressed packet size (#1527)
* Validate uncompressed packet size * Fix debug using incorrect value
This commit is contained in:
@@ -52,6 +52,9 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception {
|
||||||
int claimedUncompressedSize = ProtocolUtils.readVarInt(in);
|
int claimedUncompressedSize = ProtocolUtils.readVarInt(in);
|
||||||
if (claimedUncompressedSize == 0) {
|
if (claimedUncompressedSize == 0) {
|
||||||
|
int actualUncompressedSize = in.readableBytes();
|
||||||
|
checkFrame(actualUncompressedSize < threshold, "Actual uncompressed size %s is greater than"
|
||||||
|
+ " threshold %s", actualUncompressedSize, threshold);
|
||||||
// This message is not compressed.
|
// This message is not compressed.
|
||||||
out.add(in.retain());
|
out.add(in.retain());
|
||||||
return;
|
return;
|
||||||
|
Reference in New Issue
Block a user