]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
[libzstd] Fix bad window size assert
authorNick Terrell <terrelln@fb.com>
Tue, 19 Sep 2017 20:46:07 +0000 (13:46 -0700)
committerNick Terrell <terrelln@fb.com>
Tue, 19 Sep 2017 20:47:59 +0000 (13:47 -0700)
The window size is not validated or used in the one-pass API, so there
shouldn't be an assert based on it.

fix-fuzz-failure

lib/decompress/zstd_decompress.c

index 6d6d83396e10919ac25e898311559e18c2651641..91518990e0e9d6eab5293fcdcf38c980bb96af75 100644 (file)
@@ -1372,8 +1372,9 @@ static size_t ZSTD_decompressBlock_internal(ZSTD_DCtx* dctx,
      * conservative.
      */
     ZSTD_longOffset_e const isLongOffset = (ZSTD_longOffset_e)(MEM_32bits() && (!frame || dctx->fParams.windowSize > (1ULL << STREAM_ACCUMULATOR_MIN)));
-    /* We don't expect window sizes this big. */
-    assert(!frame || dctx->fParams.windowSize <= (1ULL << STREAM_ACCUMULATOR_MIN_64));
+    /* windowSize could be any value at this point, since it is only validated
+     * in the streaming API.
+     */
     DEBUGLOG(5, "ZSTD_decompressBlock_internal");
 
     if (srcSize >= ZSTD_BLOCKSIZE_MAX) return ERROR(srcSize_wrong);