diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index d146456ec..d0e951630 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -2723,6 +2723,11 @@ static size_t ZSTDMT_createCompressionJob(void* opaque, size_t srcSize, unsigned { ZSTDMT_CCtx* const mtctx = (ZSTDMT_CCtx*)opaque; ZSTD_EndDirective const endOp = (ZSTD_EndDirective)end; + /* Rust fills the reusable input range in its local projection before + * calling this C-owned job-construction callback. Publish that count + * before the callback prepares a job and checks the C context. */ + assert(srcSize <= mtctx->inBuff.buffer.capacity); + mtctx->inBuff.filled = srcSize; ZSTDMT_RustCreateJobProjection const projection = { mtctx->doneJobID, mtctx->nextJobID,