|
BDE 4.14.0 Production release
|
Provide a view of a buffer of fuzz data bytes.
This component defines a reference-semantic class, bslim::FuzzDataView, providing a view to a non-modifiable buffer of fuzz data obtained from a fuzz testing harness (e.g., libFuzzer).
See {http://bburl/BDEFuzzTesting} for details on how to build and run with fuzz testing enabled.
Typically, this class is intended to be employed by a utility that takes an object of this class as an in-out parameter, consumes the bytes (updating the view so that the bytes are not used again), and returns objects of the type requested.
This section illustrates intended use of this component.
The following example demonstrates how to create a bsl::string object from a FuzzDataView.
First, we construct a FuzzDataView object, view0, from an array of bytes:
Next, we take the first 3 bytes from view0 and store them in a new FuzzDataView object, view1:
We confirm that removePrefix(3) removed 3 bytes from view0 and that view1 has length 3.
Then, we create a bsl::string object from view1:
Finally, we create another bsl::string with the remaining bytes of view0: