diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-01-19 16:14:36 +0100 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2021-01-19 16:14:36 +0100 |
commit | f3de2f00775760223b6b69919bfb4fa76e99ac76 (patch) | |
tree | c57e119903f8c2b85d8ecba7d3bd20cc959c5b4a /vespajlib/src/main/java/com/yahoo/compress | |
parent | 86507230475ff6964bcb98adda345d00867ce024 (diff) |
Document pitfall with decompress()
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/compress')
-rw-r--r-- | vespajlib/src/main/java/com/yahoo/compress/ZstdCompressor.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/compress/ZstdCompressor.java b/vespajlib/src/main/java/com/yahoo/compress/ZstdCompressor.java index 5d15b102ad6..72ccb730db7 100644 --- a/vespajlib/src/main/java/com/yahoo/compress/ZstdCompressor.java +++ b/vespajlib/src/main/java/com/yahoo/compress/ZstdCompressor.java @@ -25,6 +25,11 @@ public class ZstdCompressor { return compressor.compress(input, inputOffset, inputLength, output, outputOffset, maxOutputLength); } + /** + * Note: + * Implementation assumes single frame (since {@link #getDecompressedLength(byte[], int, int)} only includes the first frame) + * The {@link #decompress(byte[], int, int, byte[], int, int)} overload will try to decompress all frame, causing the output buffer to overflow. + */ public byte[] decompress(byte[] input, int inputOffset, int inputLength) { int decompressedLength = getDecompressedLength(input, inputOffset, inputLength); byte[] output = new byte[decompressedLength]; |