Skip to content

Commit 2ae40e6

Browse files
committed
Revert "Add compression ratio limiter"
Resolves #PaperMC#1792. This is safe because of #871 (this PR mitigates actual attacks this commit was trying to resolve). This reverts commit 9890c42
1 parent 2af9453 commit 2ae40e6

1 file changed

Lines changed: 0 additions & 6 deletions

File tree

proxy/src/main/java/com/velocitypowered/proxy/protocol/netty/MinecraftCompressDecoder.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder<ByteBuf> {
4949
? HARD_MAXIMUM_UNCOMPRESSED_SIZE : SERVERBOUND_MAXIMUM_UNCOMPRESSED_SIZE;
5050

5151
private static final boolean SKIP_COMPRESSION_VALIDATION = Boolean.getBoolean("velocity.skip-uncompressed-packet-size-validation");
52-
private static final double MAX_COMPRESSION_RATIO = Double.parseDouble(System.getProperty("velocity.max-compression-ratio", "64"));
5352

5453
private final ProtocolUtils.Direction direction;
5554
private int threshold;
@@ -88,7 +87,6 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
8887
out.add(in.retain());
8988
return;
9089
}
91-
int length = in.readableBytes();
9290

9391
checkFrame(claimedUncompressedSize >= threshold, "Uncompressed size %s is less than"
9492
+ " threshold %s", claimedUncompressedSize, threshold);
@@ -100,10 +98,6 @@ protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) t
10098
checkFrame(claimedUncompressedSize <= SERVERBOUND_UNCOMPRESSED_CAP,
10199
"Uncompressed size %s exceeds hard threshold of %s", claimedUncompressedSize,
102100
SERVERBOUND_UNCOMPRESSED_CAP);
103-
double maxCompressedAllowed = length * MAX_COMPRESSION_RATIO;
104-
checkFrame(claimedUncompressedSize <= maxCompressedAllowed,
105-
"Uncompressed size %s exceeds ratio threshold of %s for compressed sized %s", claimedUncompressedSize,
106-
maxCompressedAllowed, length);
107101
}
108102
ByteBuf compatibleIn = ensureCompatible(ctx.alloc(), compressor, in);
109103
ByteBuf uncompressed = preferredBuffer(ctx.alloc(), compressor, claimedUncompressedSize);

0 commit comments

Comments
 (0)