summaryrefslogtreecommitdiffstats
path: root/lib/lz4.h
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2019-05-30 23:19:30 (GMT)
committerYann Collet <cyan@fb.com>2019-05-30 23:19:30 (GMT)
commit676d46df2723c89ca7d80fd71d3c2dc6e5be82ec (patch)
treedc2ab04d30378a10c5d54e91130a1fe76897145d /lib/lz4.h
parent6c69ae6bd69ee66b9e5051b4f88d533999240553 (diff)
downloadlz4-676d46df2723c89ca7d80fd71d3c2dc6e5be82ec.zip
lz4-676d46df2723c89ca7d80fd71d3c2dc6e5be82ec.tar.gz
lz4-676d46df2723c89ca7d80fd71d3c2dc6e5be82ec.tar.bz2
updated LZ4_DECOMPRESS_INPLACE_MARGIN
to pass worst case scenario. Now adds margin proportional to input size to counter local expansion.
Diffstat (limited to 'lib/lz4.h')
-rw-r--r--lib/lz4.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/lz4.h b/lib/lz4.h
index 91dcf64..383c2db 100644
--- a/lib/lz4.h
+++ b/lib/lz4.h
@@ -518,8 +518,8 @@ LZ4LIB_STATIC_API void LZ4_attach_dictionary(LZ4_stream_t* workingStream, const
* so there are ways to reduce memory requirements by playing with them.
*/
-#define LZ4_DECOMPRESS_INPLACE_MARGIN 32
-#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ( (decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN) /**< note: presumes that compressedSize < decompressedSize */
+#define LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize) (((decompressedSize) >> 8) + 32)
+#define LZ4_DECOMPRESS_INPLACE_BUFFER_SIZE(decompressedSize) ( (decompressedSize) + LZ4_DECOMPRESS_INPLACE_MARGIN(decompressedSize)) /**< note: presumes that compressedSize < decompressedSize */
#ifndef LZ4_DISTANCE_MAX /* history window size; can be user-defined at compile time */
# define LZ4_DISTANCE_MAX 65535 /* set to maximum value by default */