feat(compress): move sequence-store validation to Rust
Keep the C DEBUGLEVEL gate and delegate the read-only match-length validation through the existing SeqStore ABI. Preserve long-match side-band decoding and the original 3-or-4 byte lower-bound assertion. Test Plan: - cargo test --manifest-path rust/Cargo.toml --no-default-features --features compression - cargo clippy --manifest-path rust/Cargo.toml --no-default-features --features compression --all-targets - cargo +nightly fmt --manifest-path rust/Cargo.toml - make -B -C lib -j2 lib - make -C tests -j2 fuzzer - tests/fuzzer -s4560 -t47 -i48 -v
This commit is contained in:
@@ -277,6 +277,7 @@ void ZSTD_rust_storeLastLiterals(SeqStore_t* seqStorePtr,
|
||||
void ZSTD_rust_resetSeqStore(SeqStore_t* ssPtr);
|
||||
size_t ZSTD_rust_fastSequenceLengthSum(const ZSTD_Sequence* seqBuf,
|
||||
size_t seqBufSize);
|
||||
void ZSTD_rust_validateSeqStore(const SeqStore_t* seqStore, U32 minMatch);
|
||||
size_t ZSTD_rust_convertSequencesNoRepcodes(
|
||||
SeqDef* dstSeqs, const ZSTD_Sequence* inSeqs, size_t nbSequences);
|
||||
BlockSummary ZSTD_rust_get1BlockSummary(const ZSTD_Sequence* seqs,
|
||||
@@ -2348,15 +2349,7 @@ static size_t ZSTD_fastSequenceLengthSum(ZSTD_Sequence const* seqBuf, size_t seq
|
||||
static void ZSTD_validateSeqStore(const SeqStore_t* seqStore, const ZSTD_compressionParameters* cParams)
|
||||
{
|
||||
#if DEBUGLEVEL >= 1
|
||||
const SeqDef* seq = seqStore->sequencesStart;
|
||||
const SeqDef* const seqEnd = seqStore->sequences;
|
||||
size_t const matchLenLowerBound = cParams->minMatch == 3 ? 3 : 4;
|
||||
for (; seq < seqEnd; ++seq) {
|
||||
const ZSTD_SequenceLength seqLength = ZSTD_getSequenceLength(seqStore, seq);
|
||||
assert(seqLength.matchLength >= matchLenLowerBound);
|
||||
(void)seqLength;
|
||||
(void)matchLenLowerBound;
|
||||
}
|
||||
ZSTD_rust_validateSeqStore(seqStore, (U32)cParams->minMatch);
|
||||
#else
|
||||
(void)seqStore;
|
||||
(void)cParams;
|
||||
|
||||
Reference in New Issue
Block a user