curl-fuzzer C++ reference
Loading...
Searching...
No Matches
scenario_limits.h
Go to the documentation of this file.
1/*
2 * Copyright (C) Max Dymond, <cmeister2@gmail.com>, et al.
3 *
4 * SPDX-License-Identifier: curl
5 */
6
9
10#ifndef PROTO_FUZZER_SCENARIO_LIMITS_H_
11#define PROTO_FUZZER_SCENARIO_LIMITS_H_
12
13#include <cstddef>
14#include <cstdint>
15
16namespace proto_fuzzer::scenario_limits {
17
18// Keep these limits in one place because the target postprocessor and runtime
19// must agree about which protobuf suffixes can affect curl. If runtime alone
20// ignored an oversized suffix, LPM would still spend mutation and allocation
21// work on bytes that can never add coverage.
24inline constexpr std::size_t kMaxConnections = 4;
27inline constexpr std::size_t kMaxResponseChunks = 16;
30inline constexpr std::size_t kMaxOptions = 64;
33inline constexpr std::size_t kMaxAllocationFailures = 4;
36inline constexpr std::size_t kMaxAllocationOrdinal = 4096;
38inline constexpr std::size_t kMaxRequestHeaders = 16;
41inline constexpr std::size_t kMaxResolveEntries = 16;
43inline constexpr std::size_t kMaxResolveEntryBytes = 4096;
48inline constexpr std::size_t kMaxMailRecipients = 8;
51inline constexpr std::size_t kMaxMailRecipientBytes = 1024;
54inline constexpr std::size_t kMaxFileInputBytes = 64 * 1024;
57inline constexpr std::size_t kMaxFileInputTotalBytes = 128 * 1024;
61inline constexpr std::size_t kMaxTelnetOptions = 8;
64inline constexpr std::size_t kMaxTelnetOptionBytes = 1024;
67inline constexpr std::size_t kMaxTelnetResponseBytes = 8 * 1024;
72inline constexpr std::size_t kMaxTelnetControlBytes = 16;
76inline constexpr std::size_t kMaxTelnetResponseChunks = 8;
78inline constexpr std::size_t kMaxTopLevelMimeParts = 16;
80inline constexpr std::size_t kMaxNestedMimeParts = 8;
82inline constexpr std::size_t kMaxTotalMimeParts = 32;
84inline constexpr std::size_t kMaxMimeHeadersPerPart = 8;
86inline constexpr std::size_t kMaxMetadataBytes = 4096;
90inline constexpr std::size_t kMaxIpfsHostPathBytes = 4096;
95inline constexpr std::size_t kMaxDictHostPathBytes = 4 * 1024;
97inline constexpr std::size_t kMaxMimeDataBytes = 16384;
100inline constexpr std::size_t kMaxGeneratedMimePatternBytes = 256;
103inline constexpr std::size_t kMaxGeneratedMimeDataBytes = 64 * 1024 + 1;
107inline constexpr std::size_t kMaxUploadBytes = 16 * 1024;
110inline constexpr std::size_t kMaxTelnetUploadBytes = 2048;
116inline constexpr std::size_t kMaxTelnetUploadReadSize = kMaxTelnetUploadBytes;
121inline constexpr std::size_t kMaxTelnetUploadReadSteps = 2;
123inline constexpr std::size_t kMaxUploadReadSteps = 32;
125inline constexpr std::size_t kMaxUploadReadSize = kMaxUploadBytes;
129inline constexpr std::size_t kMaxApiShareDataSelectors = 16;
132inline constexpr std::size_t kMaxApiInfoSelectors = 32;
136inline constexpr std::size_t kMaxApiReentrantSelectors = 16;
139inline constexpr std::size_t kMaxApiStringBytes = 4 * 1024;
142inline constexpr std::size_t kMinMultiTransfers = 2;
144inline constexpr std::size_t kMaxMultiTransfers = 4;
148inline constexpr std::size_t kMaxMultiActions = 16;
151inline constexpr std::size_t kMaxHttp2Actions = 32;
154inline constexpr std::size_t kMaxHttp2YieldTurns = 16;
157inline constexpr std::size_t kMaxHttp2Settings = 16;
159inline constexpr std::size_t kMaxHttp2Headers = 16;
161inline constexpr std::size_t kMaxHttp2HeaderBytes = 16 * 1024;
163inline constexpr std::size_t kMaxHttp2DataBytes = 32 * 1024;
165inline constexpr std::size_t kMaxHttp2RawFrameBytes = 4 * 1024;
167inline constexpr std::size_t kMaxHttp2RawBytes = 16 * 1024;
169inline constexpr std::size_t kMaxHttp2ObservedBytes = 64 * 1024;
172inline constexpr std::size_t kMaxHttp3Actions = 16;
174inline constexpr std::size_t kMaxHttp3Headers = 16;
176inline constexpr std::size_t kMaxHttp3Trailers = 8;
179inline constexpr std::size_t kMaxHttp3HeaderNameBytes = 256;
181inline constexpr std::size_t kMaxHttp3HeaderValueBytes = kMaxMetadataBytes;
184inline constexpr std::size_t kMaxHttp3HeaderBytes = 16 * 1024;
186inline constexpr std::size_t kMaxHttp3BodyChunks = 16;
188inline constexpr std::size_t kMaxHttp3BodyBytes = 16 * 1024;
191inline constexpr std::size_t kMaxHttp3RawWriteBytes = 4 * 1024;
194inline constexpr std::size_t kMaxHttp3RawBytes = 16 * 1024;
196inline constexpr std::uint64_t kMaxQuicVarint = (std::uint64_t{1} << 62U) - 1U;
197
198} // namespace proto_fuzzer::scenario_limits
199
200#endif // PROTO_FUZZER_SCENARIO_LIMITS_H_
constexpr std::size_t kMaxUploadReadSize
Larger read requests are indistinguishable once the whole body fits.
constexpr std::size_t kMaxTelnetControlBytes
Bound reply amplification as well as input bytes.
constexpr std::size_t kMaxHttp3Trailers
Trailer lists need fewer entries while retaining duplicate-name behavior.
constexpr std::size_t kMaxAllocationFailures
A short plan reaches combinations of recovery paths without letting one input turn every allocation i...
constexpr std::size_t kMaxHttp2Settings
Bound each SETTINGS payload while retaining every standard identifier and several unknown extension v...
constexpr std::size_t kMaxHttp3BodyChunks
Bound the number of DATA-frame boundaries independently of total bytes.
constexpr std::size_t kMaxTelnetOptionBytes
Preserve curl's explicit over-1000-byte TTYPE/XDISPLOC rejection paths without giving arbitrary optio...
constexpr std::size_t kMaxHttp2Actions
Ordered H2 work can express startup, barriers, informational responses, flow-control changes,...
constexpr std::size_t kMaxHttp2YieldTurns
Sixteen turns preserve meaningful scheduler boundaries without letting a single scalar consume the co...
constexpr std::size_t kMinMultiTransfers
Two handles are the minimum that can enter shared-multi scheduling, while four align with the mock's ...
constexpr std::size_t kMaxHttp3Headers
Keep each structured header block small enough for cheap QPACK encoding.
constexpr std::size_t kMaxTelnetUploadReadSize
The TELNET peer drains immediately before each callback result.
constexpr std::uint64_t kMaxQuicVarint
QUIC variable-length integers reserve their two high bits for encoding.
constexpr std::size_t kMaxTelnetOptions
TELNET has only a handful of meaningful negotiated preferences.
constexpr std::size_t kMaxHttp3RawWriteBytes
Raw plaintext is primarily for malformed frame/QPACK prefixes; a compact per-action cap preserves tha...
constexpr std::size_t kMaxUploadReadSteps
Short-read scripts need several transitions, not mutation-sized sequences.
constexpr std::size_t kMaxApiReentrantSelectors
Each reentrancy selector fires one public API call from inside a callback.
constexpr std::size_t kMaxHttp2RawFrameBytes
Raw frame payloads target malformed parsing rather than bulk-body work.
constexpr std::size_t kMaxHttp3Actions
Ordered H3 work needs enough slots to interleave response fragments with stream and connection state ...
constexpr std::size_t kMaxHttp2ObservedBytes
Client tracking only needs frame headers and one maximum ordinary payload.
constexpr std::size_t kMaxMultiActions
Ordered lifecycle transitions remain useful in pairs (pause/resume and remove/re-add); sixteen permit...
constexpr std::size_t kMaxMimeDataBytes
MIME payloads remain large enough to cross encoder buffer boundaries.
constexpr std::size_t kMaxHttp2RawBytes
Bound aggregate raw escape data across an action sequence.
constexpr std::size_t kMaxResponseChunks
Enough response boundaries to exercise incremental parsers while keeping per-perform delivery work fi...
constexpr std::size_t kMaxHttp2HeaderBytes
Share one metadata ceiling across all H2 header blocks in a scenario.
constexpr std::size_t kMaxHttp2Headers
Keep structured HPACK work proportional to the action budget.
constexpr std::size_t kMaxMultiTransfers
Maximum easy handles configured in one shared-multi fuzz iteration.
constexpr std::size_t kMaxMailRecipientBytes
Keep recipient mailbox bytes within curl's normal address-processing range; oversized suffixes add no...
constexpr std::size_t kMaxMailRecipients
SMTP envelope recipients are schema-native because CURLOPT_MAIL_RCPT is a curl_slist.
constexpr std::size_t kMaxTelnetUploadReadSteps
OSS-Fuzz's local AF_UNIX peer normally fills curl's 4 KiB TELNET reads, so the bounded 8 KiB response...
constexpr std::size_t kMaxApiShareDataSelectors
A share handle has only a small fixed set of shareable data families.
constexpr std::size_t kMaxRequestHeaders
Request headers retain useful combinatorial interactions at this size.
constexpr std::size_t kMaxNestedMimeParts
One bounded child layer is sufficient to enter recursive MIME code.
constexpr std::size_t kMaxTotalMimeParts
Share a total budget so many parents cannot multiply their child caps.
constexpr std::size_t kMaxIpfsHostPathBytes
IPFS and IPNS inputs carry one CID/name plus a gateway path.
constexpr std::size_t kMaxUploadBytes
Maximum callback-backed body bytes visible in one scenario.
constexpr std::size_t kMaxMimeHeadersPerPart
Per-part headers are bounded separately from the part count.
constexpr std::size_t kMaxConnections
Four sockets cover redirect/auth flows without permitting mutation-sized connection chains to dominat...
constexpr std::size_t kMaxApiStringBytes
URL escaping can expand input threefold.
constexpr std::size_t kMaxFileInputBytes
One filename-only parser input can span many lines and cross curl's normal transfer buffer boundary w...
constexpr std::size_t kMaxResolveEntries
Host-cache mutations need only a compact sequence of add/remove/wildcard entries.
constexpr std::size_t kMaxApiInfoSelectors
One API iteration can cheaply inspect several result families, but an unbounded list would repeatedly...
constexpr std::size_t kMaxTelnetResponseBytes
TELNET consumes the peer synchronously, so only this bounded prefix can be preloaded before curl ente...
constexpr std::size_t kMaxAllocationOrdinal
Fold mutated ordinals into a range large enough for the bounded transfer drivers while keeping most s...
constexpr std::size_t kMaxHttp2DataBytes
Structured DATA remains large enough to cross curl's callback boundary.
constexpr std::size_t kMaxHttp3HeaderBytes
Share one metadata budget across every structured header and trailer block so many actions cannot mul...
constexpr std::size_t kMaxResolveEntryBytes
CURLOPT_RESOLVE consumes NUL-terminated host:port:address records.
constexpr std::size_t kMaxHttp3HeaderValueBytes
Values use the shared metadata ceiling used by other header-bearing APIs.
constexpr std::size_t kMaxHttp3HeaderNameBytes
Header names are tokens rather than general metadata.
constexpr std::size_t kMaxHttp3BodyBytes
A response body can still cross curl's normal 16 KiB callback boundary.
constexpr std::size_t kMaxOptions
Scalar options are cheap, but a finite list prevents protobuf allocation from growing independently o...
constexpr std::size_t kMaxGeneratedMimeDataBytes
Retain both sides of curl's 64 KiB send-buffer boundary.
constexpr std::size_t kMaxTelnetUploadBytes
TELNET writes upload bytes while its blocking driver owns the thread, so keep total callback work sma...
constexpr std::size_t kMaxTopLevelMimeParts
Bound top-level MIME traversal before curl recursively serializes it.
constexpr std::size_t kMaxMetadataBytes
Metadata reaches NUL-terminated APIs, where giant suffixes add no coverage.
constexpr std::size_t kMaxGeneratedMimePatternBytes
Longer repeated patterns are better expressed as ordinary MIME data and make the compact source less ...
constexpr std::size_t kMaxDictHostPathBytes
DICT builds its complete command synchronously before the outer mock loop can drain curl's socket.
constexpr std::size_t kMaxTelnetResponseChunks
Raw fragments are all preloaded before TELNET starts.
constexpr std::size_t kMaxHttp3RawBytes
Share one ceiling across all raw actions so sixteen maximum-sized writes cannot make one fuzzer itera...
constexpr std::size_t kMaxFileInputTotalBytes
Share a ceiling across filename-backed fixtures so populating several in one scenario cannot multiply...