Commit Graph

1 Commits

Author SHA1 Message Date
Sean Gilligan 6a2250e164
Add coverage for toml encoder (#9834)
This change fuzzes random dictionaries at the different toml encoders to
get coverage of `toml/encoder.py`. The dictionary fuzzing technique
(`atheris_dict.py`) is derivative of another library
[python-dict](github.com/abc), which is attributed in the source code.

Doing some local runs this takes `toml/encoder.py` from `16%` to `64%`
statement coverage when using libfuzz.

Interestingly I'm finding for certain parameters like the `ENCODER`
selection Python random `choice()` statements are a lot more effective
at getting coverage that the `fdp.PickValueInList()` getting an extra 9%
coverage. For now I've kept everything as the atheris fuzzer but can
switch this over if you think it's worth doing.

The introspector call graphs and coverage don't look right, which is
likely related to the existing issues on
[https://github.com/ossf/fuzz-introspector](https://github.com/ossf/fuzz-introspector).
 

![image](https://user-images.githubusercontent.com/5122866/222126280-eac53006-73e3-4a36-9983-b4acc13beae7.png)


![image](https://user-images.githubusercontent.com/5122866/222126350-b7ce3cc9-d6d2-454c-9ba7-06000a906fb9.png)
2023-03-09 04:02:31 -08:00