This proof-of-concept package provides a rudimentary framework for comparing TOML decoder implementations' handling of fuzzing input.
-
A Go 1.18 development branch or gotip environment is needed since we're using the new integrated fuzzing capabilities.
-
Each decoder must implement the toml-test decoder interface.
-
The fuzzing function requires two environment variables,
TOML_A
andTOML_B
, to be set to the paths to two decoder executables.
TOML_A=/path/to/toml-a TOML_B=/path/to/toml-b gotip test -fuzz=.
We currently have use a single FuzzUnmarshal
function.
Failed tests will be written to testdata/fuzz/FuzzUnmarshal
. Once a failed
test case is created, it will be used upon each subsequent run of the tests. If
you want to throw away a fuzz case, simply the delete the test file.
The FuzzUnmarshal
function has a addTomlTestCases
boolean that controls
whether the tests cases from toml-test
will be added as seeds to the fuzzer.
A special thanks goes out to Andrew Gallant and Martin Tournoij for creating the toml-test framework, which made this proof-of-concept a simple endeavor.