From c9490ffbcde5a5c0addfb5e45deb5ff994bb65c1 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Sat, 18 Jul 2026 09:57:54 +0200 Subject: [PATCH] fix(compress): reuse Rust block-header serializer The frame-chunk path still encoded compressed block headers directly in C even though the equivalent single-block path had moved to the Rust serializer. Route this remaining call site through the same ABI leaf so both paths retain one byte-formatting implementation and identical RLE/compressed handling. Test Plan: - `make -B -C lib -j2 lib` -- passed - `make -B -C tests -j2 fuzzer` -- passed - `tests/fuzzer -s4560 -t47 -i48 -v` -- passed - `git diff --cached --check` -- passed --- lib/compress/zstd_compress.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/compress/zstd_compress.c b/lib/compress/zstd_compress.c index ca07b2962..c3fa01418 100644 --- a/lib/compress/zstd_compress.c +++ b/lib/compress/zstd_compress.c @@ -3181,10 +3181,7 @@ static size_t ZSTD_compress_frameChunk(ZSTD_CCtx* cctx, cSize = ZSTD_rust_noCompressBlock(op, dstCapacity, ip, blockSize, lastBlock); FORWARD_IF_ERROR(cSize, "ZSTD_noCompressBlock failed"); } else { - U32 const cBlockHeader = cSize == 1 ? - lastBlock + (((U32)bt_rle)<<1) + (U32)(blockSize << 3) : - lastBlock + (((U32)bt_compressed)<<1) + (U32)(cSize << 3); - MEM_writeLE24(op, cBlockHeader); + ZSTD_rust_writeBlockHeader(op, cSize, blockSize, lastBlock); cSize += ZSTD_blockHeaderSize; } } /* if (ZSTD_useTargetCBlockSize(&cctx->appliedParams))*/