Last active
October 8, 2019 12:35
-
-
Save yevgenypats/182c31adfdfc1bb9ad0db3363b3b479c to your computer and use it in GitHub Desktop.
cargo-fuzz tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# cargo-fuzz is available in rust nightly | |
docker run -it rustlang/rust:nightly-stretch /bin/bash | |
cargo install cargo-fuzz | |
# Download the example repo, build and run the fuzzer | |
git clone https://github.com/fuzzitdev/example-rust | |
cd example-rust | |
cargo fuzz run fuzz_parse_complex | |
## The output should be like this: | |
#524288 pulse cov: 105 ft: 99 corp: 6/26b lim: 517 exec/s: 131072 rss: 93Mb | |
#1048576 pulse cov: 105 ft: 99 corp: 6/26b lim: 1040 exec/s: 116508 rss: 229Mb | |
==2208== ERROR: libFuzzer: deadly signal | |
#0 0x5588b8234961 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x83961) | |
#1 0x5588b8262dc5 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xb1dc5) | |
#2 0x5588b8284734 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xd3734) | |
#3 0x5588b82845e9 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xd35e9) | |
#4 0x5588b826493a (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xb393a) | |
#5 0x7f93737e70df (/lib/x86_64-linux-gnu/libpthread.so.0+0x110df) | |
#6 0x7f9373252ffe (/lib/x86_64-linux-gnu/libc.so.6+0x32ffe) | |
#7 0x7f9373254429 (/lib/x86_64-linux-gnu/libc.so.6+0x34429) | |
#8 0x5588b82a4a06 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf3a06) | |
#9 0x5588b82a1b75 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf0b75) | |
#10 0x5588b824fa1b (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x9ea1b) | |
#11 0x5588b82a442b (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf342b) | |
#12 0x5588b82a3ee1 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf2ee1) | |
#13 0x5588b82a3dd5 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf2dd5) | |
#14 0x5588b82b6cd9 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x105cd9) | |
#15 0x5588b82b6c94 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x105c94) | |
#16 0x5588b824edda (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x9ddda) | |
#17 0x5588b81c45b7 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x135b7) | |
#18 0x5588b824f7e4 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0x9e7e4) | |
#19 0x5588b827da53 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xcca53) | |
#20 0x5588b82a4a18 (/example-rust/fuzz/target/x86_64-unknown-linux-gnu/debug/fuzz_parse_complex+0xf3a18) | |
NOTE: libFuzzer has rudimentary signal handlers. | |
Combine libFuzzer with AddressSanitizer or similar for better crash reports. | |
SUMMARY: libFuzzer: deadly signal | |
MS: 2 ShuffleBytes-ChangeByte-; base unit: 89b92cdd9bcb9b861c47c0179eff7b3a9baafcde | |
0x46,0x55,0x5a,0x5a,0x49, | |
FUZZI | |
artifact_prefix='/example-rust/fuzz/artifacts/fuzz_parse_complex/'; Test unit written to /example-rust/fuzz/artifacts/fuzz_parse_complex/crash-df779ced6b712c5fca247e465de2de474d1d23b9 | |
Base64: RlVaWkk= | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment