FormatVerifier class
Checks that every level and tile set in a directory survives being read and written again unchanged.
Each native level (*.j2l with the game's own signature) under the directory is read completely by Jazz2::*.j2t) by Jazz2::
Public types
- struct FuzzOptions
- Limits and reproducibility of FuzzDirectory().
Public static functions
- static auto VerifyDirectory(StringView path, bool sweepTruncated = false) -> bool
- Verifies all levels and tile sets under the directory (recursively), returns
falseif any of them differs. - static auto FuzzDirectory(StringView path, StringView outputPath, const FuzzOptions& options) -> bool
- Attacks the readers with mutated copies of all levels and tile sets under the directory.
Constructors, destructors, conversion operators
- FormatVerifier() deleted
Function documentation
static bool Jazz2:: AssetPacker:: FormatVerifier:: VerifyDirectory(StringView path,
bool sweepTruncated = false)
Verifies all levels and tile sets under the directory (recursively), returns false if any of them differs.
With sweepTruncated, every level and tile set is also read cut short at many places, none of which may be read as something it isn't. That reads each file some 76 more times, so it's opt-in.
static bool Jazz2:: AssetPacker:: FormatVerifier:: FuzzDirectory(StringView path,
StringView outputPath,
const FuzzOptions& options)
Attacks the readers with mutated copies of all levels and tile sets under the directory.
Every input is a native level or tile set with seeded random mutations — of the file itself, of the decompressed content (inflated, mutated and deflated again, so the readers are attacked rather than the framing of the compression), of the chunks of a level, of its records, and of the tile sets it embeds. Every reader is run on each of them, and what a reader accepts has to survive being written and read again. An input that crashes, asserts, hangs, asks for absurd memory or doesn't survive is saved into outputPath. If path is a file, it's only run once through the readers, to reproduce a finding. Returns false if anything was found.