Skip to content
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

Add simple fuzzing #168

Merged
merged 2 commits into from
Oct 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
target
Cargo.lock
./Cargo.lock
34 changes: 28 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,24 @@
language: rust
rust:
- 1.36.0
- nightly
- beta
- stable
addons:
apt:
update: true
packages:
- binutils-dev
- libunwind8-dev
- libcurl4-openssl-dev
- libelf-dev
- libdw-dev
- cmake
- gcc
- libiberty-dev
matrix:
include:
- rust: 1.36.0
- rust: nightly
- rust: beta
env: DO_FUZZ=true
- rust: stable
env: DO_FUZZ=true
script: |
cargo build --verbose &&
cargo test --verbose &&
Expand All @@ -12,4 +27,11 @@ script: |
([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --features union) &&
([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --all-features) &&
([ $TRAVIS_RUST_VERSION != nightly ] || cargo bench --verbose bench) &&
([ $TRAVIS_RUST_VERSION != nightly ] || bash ./scripts/run_miri.sh)
([ $TRAVIS_RUST_VERSION != nightly ] || bash ./scripts/run_miri.sh) &&
if [ "$DO_FUZZ" = true ]
then
(
cd fuzz
./travis-fuzz.sh
)
fi
192 changes: 192 additions & 0 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "smallvec-fuzz"
version = "0.1.0"
authors = ["Dawid Ciężarkiewicz <[email protected]>"]
edition = "2018"
publish = false

[package.metadata]
cargo-fuzz = true

[features]
afl_fuzz = ["afl"]
honggfuzz_fuzz = ["honggfuzz"]


[dependencies]
honggfuzz = { version = "0.5.45", optional = true }
afl = { version = "0.4", optional = true }
smallvec = { path = ".." }

[workspace]
members = ["."]

[[bin]]
name = "smallvec_ops"
path = "fuzz_targets/smallvec_ops.rs"
12 changes: 12 additions & 0 deletions fuzz/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Fuzzer for smallvec

Based on fuzzing in [rust-bitcoin](https://github.com/rust-bitcoin/rust-bitcoin/tree/c8ac25219a09bf9d017f1b05abe3e746e2136f73/fuzz)

## Running manually with afl

```
cargo afl build --release --bin smallvec_ops --features afl && cargo afl fuzz -i in -o out target/release/smallvec_ops
```

# Useful links:
* https://rust-fuzz.github.io/book/afl.html
Loading