35#if defined(FUZZ_PREFIX_SIZE_FALLBACK) && defined(FUZZ_CTRL_OFF) && defined(fuzz_lane_is_structured)
37extern const size_t absolution_globals_size
__attribute__((weak));
41static inline size_t fuzz_tlv_dispatch_mutate(uint8_t *data,
48 size_t ps = FUZZ_PREFIX_SIZE_FALLBACK;
49 if (&absolution_globals_size != NULL && absolution_globals_size != 0) {
50 ps = absolution_globals_size;
53 if (ps == 0 || ps + 6 >= max_size || size <= ps + 6) {
57 uint8_t cmd_byte = fuzz_lane_is_structured(data, ps) ? data[FUZZ_CTRL_OFF + 1] : data[ps + 1];
60 if (cmd_idx >= n_configs || configs[cmd_idx].num_tags == 0 || (seed & 1U) != 0) {
66 uint8_t *payload = data + ps + 4;
67 size_t payload_size = size - ps - 4;
68 size_t max_payload = max_size - ps - 4;
70 if (payload_size <= 2 || max_payload <= 2) {
74 uint8_t *tlv_data = payload + 2;
75 size_t tlv_size =
tlv_custom_mutate(tlv_data, payload_size - 2, max_payload - 2, seed >> 2);
77 payload[0] = (uint8_t) (tlv_size >> 8);
78 payload[1] = (uint8_t) (tlv_size & 0xFF);
80 return ps + 4 + 2 + tlv_size;
const size_t fuzz_n_commands
Number of entries in fuzz_commands.
const size_t absolution_globals_size __attribute__((weak))
static size_t fuzz_custom_mutator(uint8_t *data, size_t size, size_t max_size, unsigned int seed)
The TLV grammar the mutator currently applies (one per command).
size_t num_tags
Number of entries in tags_info.
const tlv_tag_info_t * tags_info
Array of allowed tags.
Length bounds the mutator keeps for one TLV tag.
uint8_t min_len
Minimum value length to emit.
uint8_t max_len
Maximum value length to emit.
tlv_fuzz_config_t current_tlv_fuzz_config
size_t tlv_custom_mutate(uint8_t *data, size_t size, size_t max_size, unsigned int seed)
Mutate a TLV byte range in place, preserving valid framing.