Skip to content

Commit

Permalink
update minimum threshold for max block size
Browse files Browse the repository at this point in the history
  • Loading branch information
daniellerozenblit committed Jan 11, 2023
1 parent ffa08e0 commit 887298f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
3 changes: 1 addition & 2 deletions lib/compress/zstd_compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,6 @@ size_t ZSTD_CCtxParams_init(ZSTD_CCtx_params* cctxParams, int compressionLevel)
ZSTD_memset(cctxParams, 0, sizeof(*cctxParams));
cctxParams->compressionLevel = compressionLevel;
cctxParams->fParams.contentSizeFlag = 1;
// cctxParams->maxBlockSize = ZSTD_BLOCKSIZE_MAX;
return 0;
}

Expand Down Expand Up @@ -617,7 +616,7 @@ ZSTD_bounds ZSTD_cParam_getBounds(ZSTD_cParameter param)
return bounds;

case ZSTD_c_maxBlockSize:
bounds.lowerBound = 1;
bounds.lowerBound = ZSTD_BLOCKSIZE_MAX_MIN;
bounds.upperBound = ZSTD_BLOCKSIZE_MAX;
return bounds;

Expand Down
1 change: 1 addition & 0 deletions lib/zstd.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ ZSTDLIB_API const char* ZSTD_versionString(void);

#define ZSTD_BLOCKSIZELOG_MAX 17
#define ZSTD_BLOCKSIZE_MAX (1<<ZSTD_BLOCKSIZELOG_MAX)
#define ZSTD_BLOCKSIZE_MAX_MIN 1 << 10 /* The minimum valid max blocksize. Maximum blocksizes smaller than this make compressBound() inaccurate. */


/***************************************
Expand Down
2 changes: 1 addition & 1 deletion tests/fuzz/zstd_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void FUZZ_setRandomParameters(ZSTD_CCtx *cctx, size_t srcSize, FUZZ_dataProducer
setRand(cctx, ZSTD_c_useBlockSplitter, 0, 2, producer);
setRand(cctx, ZSTD_c_deterministicRefPrefix, 0, 1, producer);
setRand(cctx, ZSTD_c_prefetchCDictTables, 0, 2, producer);
setRand(cctx, ZSTD_c_maxBlockSize, 1 << 7, ZSTD_BLOCKSIZE_MAX, producer);
setRand(cctx, ZSTD_c_maxBlockSize, ZSTD_BLOCKSIZE_MAX_MIN, ZSTD_BLOCKSIZE_MAX, producer);
if (FUZZ_dataProducer_uint32Range(producer, 0, 1) == 0) {
setRand(cctx, ZSTD_c_srcSizeHint, ZSTD_SRCSIZEHINT_MIN, 2 * srcSize, producer);
}
Expand Down

0 comments on commit 887298f

Please sign in to comment.