From dc27b7ae4157024384b4766e501d9ba2788ddfd3 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Thu, 17 Sep 2020 20:59:01 -0700 Subject: comment bug on older versions of ZSTD_compress_destSize() following investigation in #859 --- lib/lz4.h | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/lz4.h b/lib/lz4.h index 5d2475c..5474005 100644 --- a/lib/lz4.h +++ b/lib/lz4.h @@ -213,7 +213,18 @@ LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* src, char* d * New value is necessarily <= input value. * @return : Nb bytes written into 'dst' (necessarily <= targetDestSize) * or 0 if compression fails. -*/ + * + * Note : from v1.8.2 to v1.9.1, this function had a bug (fixed un v1.9.2+): + * the produced compressed content could, in specific circumstances, + * require to be decompressed into a destination buffer larger + * by at least 1 byte than the content to decompress. + * If an application uses `LZ4_compress_destSize()`, + * it's highly recommended to update liblz4 to v1.9.2 or better. + * If this can't be done or ensured, + * the receiving decompression function should provide + * a dstCapacity which is > decompressedSize, by at least 1 byte. + * See https://github.com/lz4/lz4/issues/859 for details + */ LZ4LIB_API int LZ4_compress_destSize (const char* src, char* dst, int* srcSizePtr, int targetDstSize); -- cgit v0.12