refmt
refmt copied to clipboard
Create simple fuzz tests for CBOR
To run them:
go get -u github.com/dvyukov/go-fuzz/go-fuzz
go get -u github.com/dvyukov/go-fuzz/go-fuzz-build
# in cbor directory
go-fuzz-build github.com/polydawn/refmt/cbor
go-fuzz -bin=./cbor-fuzz.zip -workdir=fuzz-data # this runs until stopped by Ctrl-C
I have fuzzed it for a bit (and nudged go-fuzz to export valid coverage report). You can see the results here: https://ipfs.io/ipfs/QmaN4dfViSRD4HYX6KZ7yJfwCNtX1hahtS9C9inMgA3oED/coverage.html#file7
I've fixed a TODO that was causing the fuzzer to fail most frequently (no range checks for int conversion) but I am unsure how to add tests for it.
Example crashing input "\xc0{\xb30000000"
WIth the 2e9ba99 fuzzer could not find any more crashers.
This is super awesome. I can't wait to merge these fixes as well as the fuzzing!
I'm a doof for not seeing this in the PR queue earlier, and now I've concurrently forged ahead on... big testing refactors, coincidentally :) And that's now made merge conflicts. But I made 'em; so, I'll try to resolve 'em myself too. Hopefully I'll try to get to this this weekend! Thanks for the PR!
@warpfork any progress on this? https://github.com/polydawn/refmt/pull/24/commits/2e9ba995e90d61316d3b193c8c953323b96d3051 is quite critical. The rest can wait.
I cherry-picked 2e9ba99 and it is now f5ce9bb and on master. :taco: