fix(compress): reserve the block split terminal boundary
The optimal block splitter stores up to 196 split points and then needs one additional partition entry for the terminal sequence boundary consumed by the C block-emission loop. The previous array declaration provided only the split slots, so a maximally partitioned block could write the terminal boundary past the projected Rust/C state. Reserve the extra entry and document the layout; retain focused tests for equal-cost and estimation-error cases so the splitter continues to avoid unnecessary or invalid partitions. Test Plan: - Focused block-split Rust tests -- 7 passed - `make -B -C lib -j2 lib` -- passed - `cargo +nightly fmt --manifest-path rust/Cargo.toml -- --check` -- passed - Scoped `git diff --check` -- passed
This commit is contained in:
@@ -2841,7 +2841,7 @@ ZSTD_compressBlock_splitBlock_internal(ZSTD_CCtx* zc,
|
||||
BYTE* op = (BYTE*)dst;
|
||||
size_t i = 0;
|
||||
size_t srcBytesTotal = 0;
|
||||
U32* const partitions = zc->blockSplitCtx.partitions; /* size == ZSTD_MAX_NB_BLOCK_SPLITS */
|
||||
U32* const partitions = zc->blockSplitCtx.partitions; /* splits plus the terminal boundary */
|
||||
SeqStore_t* const nextSeqStore = &zc->blockSplitCtx.nextSeqStore;
|
||||
SeqStore_t* const currSeqStore = &zc->blockSplitCtx.currSeqStore;
|
||||
size_t const numSplits = ZSTD_deriveBlockSplits(zc, partitions, nbSeq);
|
||||
|
||||
Reference in New Issue
Block a user