added parameter litCapacity

to ZSTD_compressSequencesAndLiterals()
to enforce the litCapacity >= litSize+8 condition.
This commit is contained in:
Yann Collet
2024-12-20 10:37:01 -08:00
parent 76445bb379
commit b7a9e69d8d
5 changed files with 23 additions and 15 deletions
+4 -2
View File
@@ -1421,7 +1421,8 @@ ZSTD_compressSequences(ZSTD_CCtx* cctx,
ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx,
void* dst, size_t dstCapacity,
const ZSTD_Sequence* inSeqs, size_t nbSequences,
const void* literals, size_t litSize, size_t srcSize);
const void* literals, size_t litSize, size_t litCapacity,
size_t decompressedSize);
</b><p> This is a variant of ZSTD_compressSequences() which,
instead of receiving (src,srcSize) as input parameter, receives (literals,litSize),
aka all the literals, already extracted and laid out into a single continuous buffer.
@@ -1434,7 +1435,8 @@ ZSTD_compressSequencesAndLiterals(ZSTD_CCtx* cctx,
- 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.
- the buffer @literals must have a size @litCapacity which is larger than @litSize by at least 8 bytes.
- @decompressedSize must be correct, and correspond to the sum of all Sequences. Any discrepancy will generate an error.
@return : final compressed size, or a ZSTD error code.
</p></pre><BR>