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: source BitArray.
  • pos: byte index to modify.
  • bit_index: 0..7 bit to flip (0 is LSB).

Outputs

  • BitArray with 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 source BitArray to mutate.
  • pos: zero-based byte index to replace.
  • value: integer 0..255 to write at pos.

Outputs

  • Returns a new BitArray with the replaced byte when pos is in range.
  • Returns the original data unchanged if pos is 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.

Search Document