Mica::Testing::ByteMutator
Seeded, replayable byte-level mutations for fuzzing any format.
Every case is a pure function of (seed, iteration), so a failure can
be replayed exactly with case_bytes. Mutations range from structural
(insert a format token, delete, duplicate, splice, truncate) to hostile
bytes: every class of invalid UTF-8, forbidden controls,
noncharacters, byte order marks in the wrong place, and re-encoding the
whole input (or only its tail) as UTF-16, UTF-32 or ISO-8859-1.
A format supplies its seed documents and grammar tokens:
mutator = Mica::Testing::ByteMutator.new(
list_of_seeds: ["<a/>".to_slice],
list_of_tokens: ["<", "&"].map(&.to_slice),
)
mutator.case_bytes(7_i64, 42) # => Bytes[...]
Constants
The hostile byte classes, each with sample sequences.
The flattened list of hostile sequences.
Most mutations one case may receive.
Constructors
Instance methods
Returns the bytes for case iteration under seed.
Returns bytes with extra inserted at position.
Encodes bytes as ISO-8859-1: code points up to U+00FF become one
byte, others become ?.
Re-encodes the input, or only its tail (mixed encodings), as UTF-16, UTF-32 or ISO-8859-1, with or without a byte order mark.
Returns bytes without length bytes from start.