}
static const struct wimlib_lzms_compressor_params lzms_default = {
- .hdr = sizeof(struct wimlib_lzms_compressor_params),
+ .hdr = {
+ .size = sizeof(struct wimlib_lzms_compressor_params),
+ },
.min_match_length = 2,
.max_match_length = UINT32_MAX,
.nice_match_length = 32,
.optim_array_length = 1024,
};
+static bool
+lzms_params_valid(const struct wimlib_compressor_params_header *);
+
static const struct wimlib_lzms_compressor_params *
lzms_get_params(const struct wimlib_compressor_params_header *_params)
{
if (params == NULL)
params = &lzms_default;
+ LZMS_ASSERT(lzms_params_valid(¶ms->hdr));
+
return params;
}
if (!lz_sarray_init(&ctx->lz_sarray, max_block_size,
params->min_match_length,
- params->max_match_length,
+ min(params->max_match_length, LZ_SARRAY_LEN_MAX),
params->max_search_depth,
params->max_matches_per_pos))
goto oom;