// SPDX-License-Identifier: GPL-3.0-or-later // Copyright 2026 YAMS Contributors // Direct-P2P delta/bootstrap control frames. The first bytes choose the exchange limits so the // validators run against the same range of bounds a peer can negotiate, not only the defaults. #include "../../src/daemon/p2p/p2p_fuzz.h" // pi-lens-ignore: fatal error #include #include #include #include #include #include #include extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data, std::size_t size) { using namespace yams::daemon::p2p; if (data == nullptr || size > kP2pMaxControlFrameBytes + 64) { return 0; } FuzzedDataProvider input(data, size); DeltaExchangeOptions options; options.maxDeltasPerBatch = input.ConsumeIntegralInRange(0, 256); options.maxBatches = input.ConsumeIntegralInRange(0, 8192); options.maxDeltasPerSession = input.ConsumeIntegralInRange(0, 4096); options.maxWireBytesPerSession = input.ConsumeIntegral(); options.maxSnapshotRecords = input.ConsumeIntegralInRange(0, 4096); options.maxSnapshotWireBytes = input.ConsumeIntegral(); const auto frame = input.ConsumeRemainingBytes(); (void)detail::validateDeltaControlFrame( std::span(reinterpret_cast(frame.data()), frame.size()), options); return 0; }