Repository navigation
fix(protocol): guard flist name decode against length overflow - #5764
Merged
Merged
Conversation
Three defensive fixes to close the libFuzzer crash in differential_flist: 1. `flist/read/name.rs:90` — replace `same_len + suffix_len` with `checked_add` so a malicious wire value cannot trigger an arithmetic overflow panic in debug builds (which is what libFuzzer caught). 2. `codec/protocol/legacy.rs::read_long_name_len` — reject negative `i32` wire values explicitly instead of silently widening to `usize::MAX`. Upstream's `read_int` treats this as a protocol error. 3. `codec/protocol/modern.rs::read_long_name_len` — same negative-value guard for the varint path. Closes the differential_flist / differential_multiplex / differential_outcome artifact crashes from the nightly fuzzer run (job 27491864218). upstream: flist.c:719-722, read_varint30 dispatch
2 tasks
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
Three defensive fixes to close the libFuzzer crash in differential_flist: 1. `flist/read/name.rs:90` — replace `same_len + suffix_len` with `checked_add` so a malicious wire value cannot trigger an arithmetic overflow panic in debug builds (which is what libFuzzer caught). 2. `codec/protocol/legacy.rs::read_long_name_len` — reject negative `i32` wire values explicitly instead of silently widening to `usize::MAX`. Upstream's `read_int` treats this as a protocol error. 3. `codec/protocol/modern.rs::read_long_name_len` — same negative-value guard for the varint path. Closes the differential_flist / differential_multiplex / differential_outcome artifact crashes from the nightly fuzzer run (job 27491864218). upstream: flist.c:719-722, read_varint30 dispatch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes the libFuzzer crash in the nightly Differential Fuzzer Overnight job (run 27491864218, all three targets: differential_flist / differential_multiplex / differential_outcome).
Root cause
`crates/protocol/src/flist/read/name.rs:90` performs `same_len + suffix_len` as plain `usize` addition.
The `suffix_len` value flows from `read_long_name_len`, which on both legacy (proto < 30) and modern (proto >= 30) codecs decodes a wire `i32` and casts to `usize`. A negative wire value (e.g. `0xFFFFFFFF`) silently becomes `usize::MAX`. The subsequent `255 + usize::MAX` addition then panics in debug builds with arithmetic overflow — exactly the libFuzzer-reported "deadly signal".
Fix (three layers of defense)
Wire compatibility
Zero wire-format change. Both fixes only convert previously-panicking inputs into typed `InvalidData` errors, which is what upstream rsync does for the same conditions.
Test plan