thrifty/fuzz_utils
Values
pub fn mutate_bit_flip(
data: BitArray,
pos: Int,
bit_index: Int,
) -> BitArray
Flip a single bit in the byte at pos.
Inputs
data: sourceBitArray.pos: byte index to modify.bit_index: 0..7 bit to flip (0 is LSB).
Outputs
BitArraywith the selected bit flipped, or original data if out of range.
pub fn mutate_byte(
data: BitArray,
pos: Int,
value: Int,
) -> BitArray
Replace the byte at position pos with the provided value.
Inputs
data: the sourceBitArrayto mutate.pos: zero-based byte index to replace.value: integer 0..255 to write atpos.
Outputs
- Returns a new
BitArraywith the replaced byte whenposis in range. - Returns the original
dataunchanged ifposis out of range or on unexpected slicing errors.
pub fn mutate_delete_byte(data: BitArray, pos: Int) -> BitArray
Delete a single byte at position pos.
pub fn mutate_insert_byte(
data: BitArray,
pos: Int,
value: Int,
) -> BitArray
Insert a single byte at position pos shifting the remainder to the right.
pub fn mutate_multi_byte(
data: BitArray,
pos: Int,
len: Int,
value: Int,
) -> BitArray
Overwrite len bytes starting at pos with repeated value bytes.