Docs: Add description for fuzzer utils
+/// Apply fuzzer input data to an array that needs to be a fixed length.
+/// Fuzzer input is applied to `apply_to` and it is assumed that `apply_to` has a pre-defined
+/// length and is not empty.
pub fn apply_from_input_fixed(apply_to: &mut [u8], input: &[u8], lower_bound: usize) {
+ if apply_to.is_empty() {
+ panic!("Cannot apply data to an empty array");
+ }
if lower_bound > input.len() {
return ();
}
@@ -16,6 +22,7 @@ pub fn apply_from_input_fixed(apply_to: &mut [u8], input: &[u8], lower_bound: us
}
}
+/// Apply fuzzer input data to an array that can be any size, except for none.
pub fn apply_from_input_heap(apply_to: &mut Vec<u8>, input: &[u8], lower_bound: usize) {
if lower_bound >= input.len() {
apply_to.push(0u8);
