]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Add comment to HUF_DECOMPRESS_WORKSPACE_SIZE
authorStella Lau <laus@fb.com>
Fri, 30 Jun 2017 19:53:56 +0000 (12:53 -0700)
committerStella Lau <laus@fb.com>
Fri, 30 Jun 2017 19:53:56 +0000 (12:53 -0700)
lib/common/huf.h

index 801f74c1e75c83e6bfe50d31c1aef2e17896fb74..16184e4907ac11c28c0b7ca2fdd5228e742e17e7 100644 (file)
@@ -111,7 +111,16 @@ HUF_PUBLIC_API size_t HUF_compress2 (void* dst, size_t dstCapacity, const void*
 #define HUF_WORKSPACE_SIZE_U32 (HUF_WORKSPACE_SIZE / sizeof(U32))
 HUF_PUBLIC_API size_t HUF_compress4X_wksp (void* dst, size_t dstCapacity, const void* src, size_t srcSize, unsigned maxSymbolValue, unsigned tableLog, void* workSpace, size_t wkspSize);
 
-/* The workspace must have alignment at least 4 and be at least this large */
+/**
+ *  The minimum workspace size for the `workSpace` used in
+ *  HUF_readDTableX2_wksp() and HUF_readDTableX4_wksp().
+ *
+ *  The space used depends on HUF_TABLELOG_MAX, ranging from ~1500 bytes when
+ *  HUF_TABLE_LOG_MAX=12 to ~1850 bytes when HUF_TABLE_LOG_MAX=15.
+ *  Buffer overflow errors may potentially occur if code modifications result in
+ *  a requiredw workspace size greater than that specified in the following
+ *  macro.
+ */
 #define HUF_DECOMPRESS_WORKSPACE_SIZE (2 << 10)
 #define HUF_DECOMPRESS_WORKSPACE_SIZE_U32 (HUF_DECOMPRESS_WORKSPACE_SIZE / sizeof(U32))