From a0aa1cd070ad04541d46139c5f4d75001eadf680 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Mon, 20 Jul 2026 17:23:01 +0200 Subject: [PATCH] fix(mt): pass boolean LDM resource flag The resource-acquisition projection calls its field `ldmEnabled`, but the first implementation passed the three-state `ZSTD_ParamSwitch_e` value unchanged. `ZSTD_ps_disable` is 2, so Rust interpreted disabled LDM as enabled and rejected ordinary jobs whose raw sequence store was intentionally absent. That surfaced as an allocation error on the small stdin compression path. Convert the C enum to the same boolean semantic used by the Rust policy before crossing the ABI boundary. The projection declaration also now precedes the callback setup statements, keeping the native C90 warning-free style. Test Plan: - `ulimit -v 41943040; CARGO_BUILD_JOBS=1 cargo clippy --manifest-path rust/Cargo.toml --all-targets -- -D warnings` -- passed - `ulimit -v 41943040; cargo +nightly fmt --manifest-path rust/Cargo.toml --all -- --check` -- passed - `git diff --cached --check` -- passed - The first capped full upstream run failed at `test-zstd` on the small stdin path with the enum/boolean regression; the suite will be rerun after this fix. --- lib/compress/zstdmt_compress.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/compress/zstdmt_compress.c b/lib/compress/zstdmt_compress.c index a57571289..69ffc7a2f 100644 --- a/lib/compress/zstdmt_compress.c +++ b/lib/compress/zstdmt_compress.c @@ -1740,13 +1740,13 @@ static size_t ZSTDMT_compressionJobAcquireResources(void* opaque) ZSTDMT_compressionJobState* const state = (ZSTDMT_compressionJobState*)opaque; ZSTDMT_jobDescription* const job = state->job; + ZSTDMT_RustCompressionJobResourceProjection const projection = { + state->jobParams.ldmParams.enableLdm == ZSTD_ps_enable, + job->dstBuff.start != NULL + }; state->dstBuff = job->dstBuff; DEBUGLOG(5, "ZSTDMT_compressionJob: job %u", job->jobID); - ZSTDMT_RustCompressionJobResourceProjection const projection = { - state->jobParams.ldmParams.enableLdm, - state->dstBuff.start != NULL - }; return ZSTDMT_rust_compressionJobAcquireResources( &projection, state, ZSTDMT_compressionJobAcquireCCtx,