-
Notifications
You must be signed in to change notification settings - Fork 37.7k
tests: Add fuzzing harness for Bech32 encoding/decoding #17357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
78f224b
to
c089b42
Compare
When I try to test this,
Full configure/make gist here. I have never been able to get the fuzzing to run when following the info in doc/fuzzing.md, so this may be unrelated to the PR. Any tips would be welcome. |
Have you tried a |
@jonatack What @MarcoFalke said :) I've now updated OP with
|
It looks like that solved it. Thanks! How long does the test run -- until it's interrupted?
Concept ACK, initial code review looks good. |
@jonasnick Yes, libFuzzer runs until interrupted :) Pass Recommended setup:
You might want to look at the libFuzzer documentation too if you haven't done that already :) |
Thank you @practicalswift, I almost lost my mind trying to figure out libFuzzer today. |
Sorry - wrong Jonas/Jon. Was meaning to mention @jonatack :) |
c089b42
to
2501263
Compare
@MarcoFalke Feedback addressed! Please re-review :) |
2501263
to
b754170
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK b754170
This fuzz test afaict verifies round-trip through bech32 Decode + Encode, comparing the initial random_string with the reencoded value, then Encode + Decode and asserts the correct values for the hrp (human-readable part as a string) and data.
Tested as per PR description, read code, ran tests.
((HEAD detached at origin/pr/17357))$ src/test/fuzz/bech32 -max_total_time=60
INFO: Seed: 3403448425
INFO: Loaded 1 modules (506466 inline 8-bit counters): 506466 [0x5606fb3bc9e8, 0x5606fb43844a),
INFO: Loaded 1 PC tables (506466 PCs): 506466 [0x5606fb438450,0x5606fbbf2a70),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2 INITED cov: 746 ft: 747 corp: 1/1b lim: 4 exec/s: 0 rss: 106Mb
.../...
#316157 DONE cov: 835 ft: 2274 corp: 152/4114b lim: 122 exec/s: 5182 rss: 587Mb
###### Recommended dictionary. ######
"\xfd\xff\xff\xff" # Uses: 22198
"\x00\x00\x00\x00\x00\x00\x00\x00" # Uses: 3159
###### End of recommended dictionary. ######
Done 316157 runs in 61 second(s)
b754170 tests: Add fuzzing harness for Bech32 encoding/decoding (practicalswift) 85a34b1 tests: Move CaseInsensitiveEqual to test/util/str (practicalswift) Pull request description: Add fuzzing harness for Bech32 encoding/decoding. **Testing this PR** Run: ``` $ make distclean $ ./autogen.sh $ CC=clang CXX=clang++ ./configure --enable-fuzz \ --with-sanitizers=address,fuzzer,undefined $ make $ src/test/fuzz/bech32 -max_total_time=60 … ``` ACKs for top commit: jonatack: ACK b754170 Tree-SHA512: ade01d30c6886a083b806dbfff08999cc0d08e687701c670c895e261ed242c789e8a0062d4ebbe8f82676b8f168dc37e83351a88822c9c0eab478572a9e1ec02
I'm seeing appveyor failures:
|
Appveyor error is presumably caused by this PR and fixed by #17384 (comment) |
…ecoding b754170 tests: Add fuzzing harness for Bech32 encoding/decoding (practicalswift) 85a34b1 tests: Move CaseInsensitiveEqual to test/util/str (practicalswift) Pull request description: Add fuzzing harness for Bech32 encoding/decoding. **Testing this PR** Run: ``` $ make distclean $ ./autogen.sh $ CC=clang CXX=clang++ ./configure --enable-fuzz \ --with-sanitizers=address,fuzzer,undefined $ make $ src/test/fuzz/bech32 -max_total_time=60 … ``` ACKs for top commit: jonatack: ACK b754170 Tree-SHA512: ade01d30c6886a083b806dbfff08999cc0d08e687701c670c895e261ed242c789e8a0062d4ebbe8f82676b8f168dc37e83351a88822c9c0eab478572a9e1ec02
Summary: bitcoin/bitcoin@85a34b1 --- Partial backport of Core [[bitcoin/bitcoin#17357 | PR17357]] Test Plan: ninja check make check Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6904
…ecoding Summary: This ended up a bit different from Core's for obvious reasons bitcoin/bitcoin@b754170 --- Depends on D6904 Concludes backport of Core [[bitcoin/bitcoin#17357 | PR17357]] Test Plan: cmake -GNinja .. -DENABLE_SANITIZERS="address;fuzzer" -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ ninja bitcoin-fuzzers ./src/test/fuzz/cashaddr Reviewers: #bitcoin_abc, deadalnix Reviewed By: #bitcoin_abc, deadalnix Subscribers: deadalnix Differential Revision: https://reviews.bitcoinabc.org/D6906
…ecoding b754170 tests: Add fuzzing harness for Bech32 encoding/decoding (practicalswift) 85a34b1 tests: Move CaseInsensitiveEqual to test/util/str (practicalswift) Pull request description: Add fuzzing harness for Bech32 encoding/decoding. **Testing this PR** Run: ``` $ make distclean $ ./autogen.sh $ CC=clang CXX=clang++ ./configure --enable-fuzz \ --with-sanitizers=address,fuzzer,undefined $ make $ src/test/fuzz/bech32 -max_total_time=60 … ``` ACKs for top commit: jonatack: ACK b754170 Tree-SHA512: ade01d30c6886a083b806dbfff08999cc0d08e687701c670c895e261ed242c789e8a0062d4ebbe8f82676b8f168dc37e83351a88822c9c0eab478572a9e1ec02
Add fuzzing harness for Bech32 encoding/decoding.
Testing this PR
Run: