refmt icon indicating copy to clipboard operation
refmt copied to clipboard

Create simple fuzz tests for CBOR

Open Kubuxu opened this issue 6 years ago • 5 comments

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

Kubuxu avatar Apr 06 '18 09:04 Kubuxu

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"

Kubuxu avatar Apr 06 '18 16:04 Kubuxu

WIth the 2e9ba99 fuzzer could not find any more crashers.

Kubuxu avatar Apr 06 '18 17:04 Kubuxu

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 avatar Jun 21 '18 21:06 warpfork

@warpfork any progress on this? https://github.com/polydawn/refmt/pull/24/commits/2e9ba995e90d61316d3b193c8c953323b96d3051 is quite critical. The rest can wait.

Kubuxu avatar Sep 07 '18 18:09 Kubuxu

I cherry-picked 2e9ba99 and it is now f5ce9bb and on master. :taco:

warpfork avatar Sep 09 '18 13:09 warpfork