]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Disallow tableLog == srcLog 1255/head
authorNick Terrell <terrelln@fb.com>
Thu, 2 Aug 2018 18:12:17 +0000 (11:12 -0700)
committerNick Terrell <terrelln@fb.com>
Thu, 2 Aug 2018 18:12:17 +0000 (11:12 -0700)
lib/compress/fse_compress.c

index 95e7c1c7e749dc8f8567495c07533c3da4c73ba0..70daae3bc2951e432ce14586d892aeae9f3c9141 100644 (file)
@@ -331,7 +331,7 @@ void FSE_freeCTable (FSE_CTable* ct) { free(ct); }
 /* provides the minimum logSize to safely represent a distribution */
 static unsigned FSE_minTableLog(size_t srcSize, unsigned maxSymbolValue)
 {
-    U32 minBitsSrc = BIT_highbit32((U32)(srcSize - 1)) + 1;
+    U32 minBitsSrc = BIT_highbit32((U32)(srcSize)) + 1;
     U32 minBitsSymbols = BIT_highbit32(maxSymbolValue) + 2;
     U32 minBits = minBitsSrc < minBitsSymbols ? minBitsSrc : minBitsSymbols;
     assert(srcSize > 1); /* Not supported, RLE should be used instead */