From: Yann Collet Date: Thu, 19 Dec 2024 23:39:57 +0000 (-0800) Subject: add a check, to return an error if Sequence validation is enabled X-Git-Tag: v1.5.7^2~48^2~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=76445bb379fe74b0a8cddcce2658c111a2e8d7b0;p=thirdparty%2Fzstd.git add a check, to return an error if Sequence validation is enabled since ZSTD_compressSequencesAndLiterals() doesn't support it. --- diff --git a/doc/zstd_manual.html b/doc/zstd_manual.html index 30908e0aa..dd6f9d7ab 100644 --- a/doc/zstd_manual.html +++ b/doc/zstd_manual.html @@ -1430,7 +1430,8 @@ ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx, It's a speed optimization, useful when the right conditions are met, but it also features the following limitations: - Only supports explicit delimiter mode - - Not compatible with frame checksum, which must disabled + - Currently does not support Sequences validation (so input Sequences are trusted) + - Not compatible with frame checksum, which must be disabled - If any block is incompressible, will fail and return an error - @litSize must be == sum of all @.litLength fields in @inSeqs. Any discrepancy will generate an error. - the buffer @literals must be larger than @litSize by at least 8 bytes. diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index 5ef7337cc..b5831650f 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -7319,6 +7319,9 @@ ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx, if (cctx->appliedParams.blockDelimiters == ZSTD_sf_noBlockDelimiters) { RETURN_ERROR(frameParameter_unsupported, "This mode is only compatible with explicit delimiters"); } + if (cctx->appliedParams.validateSequences) { + RETURN_ERROR(parameter_unsupported, "This mode is not compatible with Sequence validation"); + } if (cctx->appliedParams.fParams.checksumFlag) { RETURN_ERROR(frameParameter_unsupported, "this mode is not compatible with frame checksum"); } diff --git a/lib/zstd.h b/lib/zstd.h index 68e78b3ca..feb1ae17a 100644 --- a/lib/zstd.h +++ b/lib/zstd.h @@ -1674,7 +1674,8 @@ ZSTD_compressSequences(ZSTD_CCtx* cctx, * It's a speed optimization, useful when the right conditions are met, * but it also features the following limitations: * - Only supports explicit delimiter mode - * - Not compatible with frame checksum, which must disabled + * - Currently does not support Sequences validation (so input Sequences are trusted) + * - Not compatible with frame checksum, which must be disabled * - If any block is incompressible, will fail and return an error * - @litSize must be == sum of all @.litLength fields in @inSeqs. Any discrepancy will generate an error. * - the buffer @literals must be larger than @litSize by at least 8 bytes.