Skip to main content

Module adversarial

Module adversarial 

Source
Expand description

Adversarial input generators.

These generators produce inputs that exercise failure paths: oversized files, malformed UTF-8, unusual filenames. Every generator is deterministic given a seed (where applicable).

§Use cases

  • Oversized: confirm that buffer-allocation paths handle files larger than common assumptions.
  • Malformed UTF-8: confirm that decoders return errors instead of panicking on invalid bytes.
  • Unusual names: confirm that path-handling code copes with Unicode, emoji, very long names, etc.

Functions§

malformed_utf8
Write a deliberately malformed UTF-8 byte sequence to path.
oversized_sparse
Write size_bytes to path using set_len, which on most platforms creates a sparse file (no actual disk space used until written to).
oversized_zeros
Write size_bytes of zeroes to path. The parent directory MUST exist.
random_bytes
Write n deterministic bytes to path using a splitmix64-derived stream seeded by seed.
unusual_names
Names that are valid on most filesystems but exercise edge cases: long names, Unicode, emoji, leading dot.