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-20 12:23:29 +0100 |
commit | 647afcf0826e2d3e8fad0d3c529ffaf1a32712aa (patch) | |
tree | 10b062473132632c8da00c2ef85a8ba6791e41d3 /vespajlib/src/main/java/com/yahoo/compress | |
parent | c9a8248b49109bd4f3abde4c0c492efb04707eab (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]; |