Luminarys / synapse

Synapse BitTorrent Daemon
https://synapse-bt.org
ISC License
853 stars 48 forks source link

Add fuzzing for Bencode #168

Closed ArniDagur closed 4 years ago

ArniDagur commented 4 years ago

This PR adds fuzzing for the project using cargo fuzz. I wrote an entrypoint for the synapse-bencode crate, which does a decode -> encode -> decode roundtrip. You can run the fuzzer on said entrypoint using the command: cargo fuzz run bencode_roundtrip.

The fuzzer has discovered that some inputs make the crate go OOM, such as d2222222222:l. I'm not sure if that's a bug or not.

Luminarys commented 4 years ago

Looks good, thanks!

Luminarys commented 4 years ago

That sort of input is definitely not intended to crash things, I've added a fix. Will probably look into extending support for this for other input formats as well, seems quite convenient.

Thanks again.