Increase maximum accepted reassembled packet size to 1MB, but continue to constrain directly received packet size at 65KB
This commit is contained in:
+1
-1
@@ -92,7 +92,7 @@ public class PacketReassembly {
|
||||
reassemblyBuffer.position(0);
|
||||
|
||||
if (firstPacket.getHeader().getPacketFlag(HeaderFlag.COMPRESSED))
|
||||
reassemblyBuffer = ByteBuffer.wrap(QuickLZ.decompress(reassemblyBuffer.array()));
|
||||
reassemblyBuffer = ByteBuffer.wrap(QuickLZ.decompress(reassemblyBuffer.array(), 1024 * 1024));
|
||||
|
||||
reassembledPacket.readBody(reassemblyBuffer);
|
||||
|
||||
|
||||
+1
-1
@@ -584,7 +584,7 @@ public abstract class AbstractTeamspeakClientSocket
|
||||
if (packet.getBody() instanceof PacketBodyCompressed) {
|
||||
Ts3Debugging.debug("[PROTOCOL] DECOMPRESS " + networkPacket.getHeader().getType().name());
|
||||
|
||||
byte[] decompressed = QuickLZ.decompress(((PacketBodyCompressed) packet.getBody()).getCompressed());
|
||||
byte[] decompressed = QuickLZ.decompress(((PacketBodyCompressed) packet.getBody()).getCompressed(), 65535);
|
||||
|
||||
packetBuffer = ByteBuffer
|
||||
.wrap(decompressed)
|
||||
|
||||
@@ -310,7 +310,7 @@ public final class QuickLZ
|
||||
a[i + j] = (byte)(value >>> (j * 8));
|
||||
}
|
||||
|
||||
static public byte[] decompress(byte[] source) throws IOException {
|
||||
static public byte[] decompress(byte[] source, int maximum) throws IOException {
|
||||
try {
|
||||
int level = (source[0] >>> 2) & 0x3;
|
||||
|
||||
@@ -318,7 +318,7 @@ public final class QuickLZ
|
||||
throw new IllegalArgumentException("unsupported QuickLZ level: " + level);
|
||||
|
||||
int size = (int) sizeDecompressed(source);
|
||||
if (size > 65536)
|
||||
if (size > maximum)
|
||||
throw new IllegalArgumentException("decompression too large: " + size);
|
||||
|
||||
int src = headerLen(source);
|
||||
|
||||
Reference in New Issue
Block a user