Load into output a character sequence of length at most maxLength.

Synopsis

Declared in <bslim_fuzzutil.h>

static
void
consumeRandomLengthChars(
    bsl::vector<char>* output,
    FuzzDataView* fuzzDataView,
    std::size_t maxLength);

Description

Load into the specified output a sequence of characters of length from 0 to the specified maxLength. If the specified fuzzDataView has fewer bytes than maxLength, load at most fuzzDataView‐>length() bytes into output. If the buffer in fuzzDataView contains two successive backslash characters, then in output they will be converted to a single backslash () character; if a single backslash character is encountered, the consumption of bytes is terminated. Note that because double backslashes are mapped to single backslashes, more than maxLength bytes may be consumed from the buffer to produce the output. Also note that the purpose of this function is to enable the creation of a non‐zero‐terminated string_view, which is not possible with the string counterpart.

Parameters

Name

Description

output

destination for the generated character sequence

fuzzDataView

view providing fuzz input bytes

maxLength

maximum number of characters to load into output

Created with MrDocs