feat(compress): route parameter bounds checks through Rust
Parameter-bound lookup already lived in Rust, but the internal C helper still performed the error and interval comparison locally. Call the existing Rust bounds predicate directly so the compression parameter policy has one owner while preserving the C helper and its callers. Test Plan: - ulimit -v 41943040; make -j1 - ulimit -v 41943040; make -j1 -C tests test - Previous capped cargo check and clippy passed for the unchanged Rust API.
This commit is contained in:
@@ -622,13 +622,10 @@ MEM_STATIC U32 ZSTD_MLcode(U32 mlBase)
|
||||
/* ZSTD_cParam_withinBounds:
|
||||
* @return 1 if value is within cParam bounds,
|
||||
* 0 otherwise */
|
||||
int ZSTD_rust_cctx_params_within_bounds(int param, int value);
|
||||
MEM_STATIC int ZSTD_cParam_withinBounds(ZSTD_cParameter cParam, int value)
|
||||
{
|
||||
ZSTD_bounds const bounds = ZSTD_cParam_getBounds(cParam);
|
||||
if (ZSTD_isError(bounds.error)) return 0;
|
||||
if (value < bounds.lowerBound) return 0;
|
||||
if (value > bounds.upperBound) return 0;
|
||||
return 1;
|
||||
return ZSTD_rust_cctx_params_within_bounds((int)cParam, value);
|
||||
}
|
||||
|
||||
/* ZSTD_selectAddr:
|
||||
|
||||
Reference in New Issue
Block a user