Commit Graph

14 Commits

Author SHA1 Message Date
y
e23a5e9ee5 fuzz: Add differential fuzzing for BTC VarInt
DarkFi's VarInt struct is meant to be equivalent to the one used by BTC.
Most of the source code is extremeley similar. This commit adds very
basic tests to ensure equivalence between DarkFi's implementation and
the one used by the BTC crate.
The tests included here are quite basic. Future work can expand on
the testing done on the deserialized values.
This harness can also be used as as guide or template for future
differential fuzzing.
2023-09-06 10:57:28 +00:00
greptile
8a806b2cfc fuzz: improve docs for memory settings (#208)
* fuzz: improve docs for memory settings

* wording improvement

* Add instructions for more optimal fuzzing

---------

Co-authored-by: y <y>
2023-09-06 10:56:51 +00:00
greptile
d9d918b884 fuzz: Add honggfuzz (#206)
* fuzz: Add honggfuzz

- Added honggfuzz in fuzz2/ (alongside libfuzzer in fuzz/)
- Created convenience script for fuzzing binary decoder
- Created a script to convert inputs that cause crashes into arrays so
  that they can be used in unit tests

* Create honggfuzz as subdirectory of fuzz/

- Reorg so that honggfuzz is under fuzz/ instead of in a separate
  sibling-level directory fuzz2
- Update fuzz/README.md to make it explicit that it covers libfuzzer

Note: `cargo fuzz`/libfuzzer seems to insist that its folder exists at
`$REPO/fuzz/` so that's the reason for this particular folder structure.

---------

Co-authored-by: y <y>
2023-09-04 16:42:34 +00:00
greptile
7e76cf360c docs: Add more details about fuzzing (#201)
Add more documentation to fuzz/README.md, especially when it comes to
interpreting out-of-memory issues.

Co-authored-by: y <y>
Co-authored-by: parazyd <parazyd@users.noreply.github.com>
2023-08-30 05:44:42 +00:00
y
374d19851f fuzz: Restructure corpora git structure
Use artifacts/ rather than corpus/ to track fuzz inputs. corpus appears
to be a temporary directory that will be modified when minimizing test
cases using commands like `cargo fuzz cmin` or `cargo fuzz tmin`. For
this reason it's not suitable for long-term storage and is likely to
make the git commit-staging process very messy.
2023-08-30 05:42:23 +00:00
parazyd
cbe9c64065 chore: Update crate dependencies 2023-08-29 13:08:35 +02:00
parazyd
0440864b3a fuzz: Use patched blake2_simd crate. 2023-08-29 08:58:49 +02:00
y
433ff9d0a6 fuzz: Add harness for decoding strings from bytes
- Add a fuzz harness for deserializing strings from bytes
- Add entry to corpora that triggers an out-of-memory issue in string
  decoding
2023-08-25 06:37:57 +00:00
y
5ac92e3093 fuzz: improve readme and corpora wording 2023-08-24 18:37:46 +00:00
y
7c1cd791f2 Add out-of-memory crash to corpora
This input caused an out-of-memory bug. I haven't figured out why yet
but it's good to keep this in the corpus for future testing.

Something interesting: the fuzzer brute-forced the MAGIC BYTES for the
binary on its own! This file is a good starting point for future fuzzing
because it contains the magic bytes: subsequent runs can start from here
instead of needing to "find" the magic bytes via brute forcing every
time
2023-08-24 18:37:46 +00:00
y
bc16b6c475 Add instructions for building the fuzzing corpus
- Inform devs how to build an organized and useful corpora based on the
results of fuzz testing.
- Modify .gitignore to allow corpus/ tracking. Note: files in corpus/
  should not be blindly committed but selectively added based on
  usefulness
- Add emptyfile to zkas-decoder corpus because it caused a panic
2023-08-24 18:37:46 +00:00
y
382205ad81 Add fuzzer for ZkBinary::decode() 2023-08-24 18:37:46 +00:00
parazyd
fe215e632c fuzz: Add zkas Lexer fuzzer. 2023-08-23 23:54:33 +02:00
parazyd
00e4456787 fuzz: Serialize attempt 2023-08-23 22:21:42 +02:00