Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-17 05:20:14 +01:00
Allow certain mangled large packets to pass through
Dieser Commit ist enthalten in:
Ursprung
bfea41e7e3
Commit
4940f6b447
@ -35,10 +35,9 @@ public class MinecraftCompressDecoder extends MessageToMessageDecoder<ByteBuf> {
|
|||||||
|
|
||||||
checkFrame(expectedSize >= threshold, "Uncompressed size %s is greater than threshold %s",
|
checkFrame(expectedSize >= threshold, "Uncompressed size %s is greater than threshold %s",
|
||||||
expectedSize, threshold);
|
expectedSize, threshold);
|
||||||
checkFrame(expectedSize <= MAXIMUM_UNCOMPRESSED_SIZE, "Expected uncompressed size"
|
int initialCapacity = Math.min(expectedSize, MAXIMUM_UNCOMPRESSED_SIZE);
|
||||||
+ "%s is larger than protocol maximum of %s", expectedSize, MAXIMUM_UNCOMPRESSED_SIZE);
|
|
||||||
ByteBuf compatibleIn = ensureCompatible(ctx.alloc(), compressor, in);
|
ByteBuf compatibleIn = ensureCompatible(ctx.alloc(), compressor, in);
|
||||||
ByteBuf uncompressed = preferredBuffer(ctx.alloc(), compressor, expectedSize);
|
ByteBuf uncompressed = preferredBuffer(ctx.alloc(), compressor, initialCapacity);
|
||||||
try {
|
try {
|
||||||
compressor.inflate(compatibleIn, uncompressed, expectedSize);
|
compressor.inflate(compatibleIn, uncompressed, expectedSize);
|
||||||
out.add(uncompressed);
|
out.add(uncompressed);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren