🟡 Minor
Guard exponent conversions for extreme attack rates (src/headerssync.cpp:531, head)
ComputeHeadersSyncParamsInner checks only that attack_headers > 0 (line 404). For sufficiently small positive finite values, k can exceed the range of int, making the conversion of k + 4 for std::ldexp undefined behavior. The attack-rate calculation at line 452 has the same issue with k + 2. Constrain and validate the accepted rate range, or handle exponents without out-of-range integer conversions.
Avoid overflow when scaling negative timespans (src/headerssync.cpp:609, head)
For a representable std::chrono::seconds duration with a sufficiently large-magnitude negative count, 6 * timespan.count() overflows signed int64_t before std::max applies the minimum-chainwork bound. Clamp nonpositive timespans before multiplying, or use checked or saturating arithmetic. The fuzz target's narrower range does not cover this boundary.
Check header-count bounds before computing the optimizer clamp (src/headerssync.cpp:609, head)
minchainwork_headers is checked only for positivity at line 602, but 2 * minchainwork_headers + 1 can overflow signed int64_t for sufficiently large positive inputs. The inner optimizer also evaluates 2 * minchainwork_headers in its precondition at line 406. Validate a safe upper bound or use checked arithmetic before deriving and passing the optimizer inputs.
💡 Suggestion
Pass precomputed headers-sync parameters to the private-broadcast fuzz target (src/net_processing.cpp:2139, head)
The private-broadcast fuzz target reconstructs PeerManager each iteration without the precomputed headers_sync_params option. This runs the headers-sync optimizer on every input, adding work unrelated to the target's private-broadcast behavior. Pass FUZZ_HEADERS_SYNC_PARAMS in that target's options, as in the other updated per-iteration fuzz targets. This preserves tested behavior while leaving optimizer coverage to the dedicated parameter-computation fuzz targets.