diff --git a/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java b/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java index e9cd08c11..9a0ff27bd 100644 --- a/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java +++ b/native/src/main/java/com/velocitypowered/natives/compression/JavaVelocityCompressor.java @@ -49,9 +49,9 @@ public class JavaVelocityCompressor implements VelocityCompressor { destination.writerIndex(destination.writerIndex() + produced); } - if (inflater.getBytesWritten() != uncompressedSize) { - throw new DataFormatException("Did not write the exact expected number of" - + " uncompressed bytes, expected " + uncompressedSize); + if (!inflater.finished()) { + throw new DataFormatException("Received a deflate stream that was too large, wanted " + + uncompressedSize); } source.readerIndex(origIdx + inflater.getTotalIn()); } finally {