Skip to content

generator: cap block s2length at the negotiated checksum length#961

Merged
tridge merged 2 commits into
RsyncProject:masterfrom
tridge:pr-old-openat2-fix
Jun 4, 2026
Merged

generator: cap block s2length at the negotiated checksum length#961
tridge merged 2 commits into
RsyncProject:masterfrom
tridge:pr-old-openat2-fix

Conversation

@tridge
Copy link
Copy Markdown
Member

@tridge tridge commented Jun 4, 2026

fixes a hash issue on old hosts (tested on ubuntu 20.04) with old libxxhash.

tridge added 2 commits June 4, 2026 14:04
sum_sizes_sqroot() capped the strong-sum length at SUM_LENGTH (16), the
legacy MD4/MD5 digest size.  Since 0902b52 the sum2 array elements are
xfer_sum_len bytes and the sender rejects a sums header whose s2length
exceeds xfer_sum_len.  When the negotiated transfer checksum is shorter
than 16 bytes -- xxh64 (8), used when the build's libxxhash lacks
xxh128/xxh3 (e.g. Ubuntu 20.04) -- the generator still emitted s2length
up to 16, so --append-verify and other full-checksum (redo) transfers
died with "Invalid checksum length 16 [sender]" (protocol incompatibility).

Cap s2length at MIN(SUM_LENGTH, xfer_sum_len): unchanged for any checksum
>= 16 bytes (md5/xxh128/sha1), corrected for short ones.  Also closes a
latent over-read of the xfer_sum_len-sized digest buffer.
Forces --checksum-choice=xxh64 (an 8-byte transfer checksum) with a
corrupted-prefix --append-verify so the full-checksum redo path runs.
Before the generator capped s2length at MIN(SUM_LENGTH, xfer_sum_len)
this died with "Invalid checksum length 16 [sender]"; the test is RED on
the prior generator and GREEN with the cap.  Reproduces on any build that
has xxhash, so it guards the fix without an old-libxxhash host; skips when
xxh64 is absent (a build without xxhash).
@tridge tridge changed the title generator: cap block s2length at the negotiated checksum lengthPr old openat2 fix generator: cap block s2length at the negotiated checksum length Jun 4, 2026
@tridge tridge merged commit 3691b71 into RsyncProject:master Jun 4, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant