Better check for unfinished decompression

This commit is contained in:
Andrew Steinborn
2020-11-17 04:48:52 -05:00
parent b599e7b45c
commit c140599a53

View File

@@ -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 {