Skip to content

docs(audits): MD4 get_checksum2 buf1 initialization parity vs 3.4.2 - #4084

Merged
oferchen merged 1 commit into
masterfrom
docs/3.4.2-md4-buf1-audit-2223
May 15, 2026
Merged

oferchen merged 1 commit into
masterfrom
docs/3.4.2-md4-buf1-audit-2223

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Closes #2123 (or refs, depending on tracker).

Upstream rsync 3.4.2 NEWS records: "Fixed an uninitialized buf1 on
the first call to get_checksum2() in the MD4 path (fixes #673)"
. The
upstream patch (checksum.c:369) forces the static buf1 cache to be
allocated whenever the pointer is NULL, not only when len > len1.
Before the fix, the very first call with len == 0 and a non-zero
checksum_seed walked through memcpy(NULL, _, 0) (UB) and
SIVAL(NULL, 0, seed) (write through NULL).

oc-rsync has no equivalent of the static buf1 cache: the MD4 path
streams the input slice and the optional 4-byte seed directly into the
digest backend. Every audited site either passes a slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

  • Audit document: docs/audits/upstream-3.4.2-md4-buf1-parity.md -
    enumerates each MD4 site (strong-checksum entry, strategy dispatch,
    parallel files/blocks, SIMD batch padding for scalar / AVX2 / AVX512
    / NEON / SSE2 / wasm) with verdicts.
  • Regression test: md4_seeded_empty_input_matches_seed_only_digest
    in crates/checksums/src/strong/md4.rs - pins the exact 3.4.1
    trigger (empty input + non-zero seed) by asserting
    digest_with_seed(seed, b"") equals MD4 of the 4-byte LE seed.

No production code change required.

Test plan

  • fmt+clippy (CI)
  • nextest (stable) - includes the new
    md4_seeded_empty_input_matches_seed_only_digest regression test
  • Windows (stable) / macOS (stable) / Linux musl (stable)

Refs #2123. Upstream 3.4.2 NEWS records "Fixed an uninitialized buf1
on the first call to get_checksum2() in the MD4 path (fixes #673)".
The fix forces buf1 allocation whenever the static cache is NULL, not
just when len grows past len1.

oc-rsync does not maintain a static heap-backed buf1 accumulator; the
MD4 path streams the input slice and the optional 4-byte seed directly
into the digest backend. Every audited site (Md4::digest_with_seed,
Md4Strategy, parallel files/blocks, SIMD batch padding for scalar,
AVX2, AVX512, NEON, SSE2, wasm) either passes the slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

Pins the exact 3.4.1 trigger (empty input + non-zero seed) with a
new regression test asserting digest_with_seed(seed, b"") equals the
MD4 of the 4-byte little-endian seed alone.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 15, 2026
@oferchen
oferchen merged commit 7574e2d into master May 15, 2026
44 of 45 checks passed
@oferchen
oferchen deleted the docs/3.4.2-md4-buf1-audit-2223 branch May 16, 2026 19:50
oferchen added a commit that referenced this pull request May 18, 2026
…4084)

Refs #2123. Upstream 3.4.2 NEWS records "Fixed an uninitialized buf1
on the first call to get_checksum2() in the MD4 path (fixes #673)".
The fix forces buf1 allocation whenever the static cache is NULL, not
just when len grows past len1.

oc-rsync does not maintain a static heap-backed buf1 accumulator; the
MD4 path streams the input slice and the optional 4-byte seed directly
into the digest backend. Every audited site (Md4::digest_with_seed,
Md4Strategy, parallel files/blocks, SIMD batch padding for scalar,
AVX2, AVX512, NEON, SSE2, wasm) either passes the slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

Pins the exact 3.4.1 trigger (empty input + non-zero seed) with a
new regression test asserting digest_with_seed(seed, b"") equals the
MD4 of the 4-byte little-endian seed alone.
oferchen added a commit that referenced this pull request May 18, 2026
…4084)

Refs #2123. Upstream 3.4.2 NEWS records "Fixed an uninitialized buf1
on the first call to get_checksum2() in the MD4 path (fixes #673)".
The fix forces buf1 allocation whenever the static cache is NULL, not
just when len grows past len1.

oc-rsync does not maintain a static heap-backed buf1 accumulator; the
MD4 path streams the input slice and the optional 4-byte seed directly
into the digest backend. Every audited site (Md4::digest_with_seed,
Md4Strategy, parallel files/blocks, SIMD batch padding for scalar,
AVX2, AVX512, NEON, SSE2, wasm) either passes the slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

Pins the exact 3.4.1 trigger (empty input + non-zero seed) with a
new regression test asserting digest_with_seed(seed, b"") equals the
MD4 of the 4-byte little-endian seed alone.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4084)

Refs #2123. Upstream 3.4.2 NEWS records "Fixed an uninitialized buf1
on the first call to get_checksum2() in the MD4 path (fixes #673)".
The fix forces buf1 allocation whenever the static cache is NULL, not
just when len grows past len1.

oc-rsync does not maintain a static heap-backed buf1 accumulator; the
MD4 path streams the input slice and the optional 4-byte seed directly
into the digest backend. Every audited site (Md4::digest_with_seed,
Md4Strategy, parallel files/blocks, SIMD batch padding for scalar,
AVX2, AVX512, NEON, SSE2, wasm) either passes the slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

Pins the exact 3.4.1 trigger (empty input + non-zero seed) with a
new regression test asserting digest_with_seed(seed, b"") equals the
MD4 of the 4-byte little-endian seed alone.
oferchen added a commit that referenced this pull request Aug 24, 2026
…4084)

Refs #2123. Upstream 3.4.2 NEWS records "Fixed an uninitialized buf1
on the first call to get_checksum2() in the MD4 path (fixes #673)".
The fix forces buf1 allocation whenever the static cache is NULL, not
just when len grows past len1.

oc-rsync does not maintain a static heap-backed buf1 accumulator; the
MD4 path streams the input slice and the optional 4-byte seed directly
into the digest backend. Every audited site (Md4::digest_with_seed,
Md4Strategy, parallel files/blocks, SIMD batch padding for scalar,
AVX2, AVX512, NEON, SSE2, wasm) either passes the slice by reference
or zero-initializes its scratch buffer. No MaybeUninit appears under
crates/checksums/src/.

Pins the exact 3.4.1 trigger (empty input + non-zero seed) with a
new regression test asserting digest_with_seed(seed, b"") equals the
MD4 of the 4-byte little-endian seed alone.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant