Skip to content

Commit

Permalink
Add initial fuzz corpus files (#73)
Browse files Browse the repository at this point in the history
### What
Add a new fuzz corpus with multiple seed files.

### Why
Adding fuzz testing, which I've been playing around with. The corpus is made up of test vectors from SEP-23. I added a test that was missing as well.
  • Loading branch information
leighmcculloch authored Jan 15, 2025
1 parent 8f5fb5b commit 67b79ae
Show file tree
Hide file tree
Showing 125 changed files with 389 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:

complete:
if: always()
needs: [fmt, build-and-test, publish-dry-run]
needs: [fmt, build-and-test, publish-dry-run, fuzz-corpus]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
Expand Down Expand Up @@ -64,3 +64,21 @@ jobs:
with:
runs-on: ${{ matrix.os }}
target: ${{ matrix.target }}

fuzz-corpus:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- uses: stellar/binaries@v33
with:
name: cargo-fuzz
version: 0.12.0
- run: rustup install nightly
- run: rustup default nightly
- name: Run fuzz corpus
run: |
cd fuzz
for target in $(cargo fuzz list); do
cargo fuzz run $target -- -runs=0
done
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ export RUSTFLAGS=-Dwarnings

test:
cargo test
cargo +nightly fuzz run fuzz_roundtrip -- -runs=0

fuzz:
cargo +nightly fuzz run fuzz_roundtrip -j 4

build:
cargo build
Expand All @@ -21,3 +25,5 @@ fmt:

clean:
cargo clean

.PHONY: all test fuzz build check install fmt clean
3 changes: 3 additions & 0 deletions fuzz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
target
artifacts
coverage
197 changes: 197 additions & 0 deletions fuzz/Cargo.lock

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

21 changes: 21 additions & 0 deletions fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[package]
name = "stellar-strkey-fuzz"
version = "0.0.0"
publish = false
edition = "2021"

[package.metadata]
cargo-fuzz = true

[dependencies]
libfuzzer-sys = "0.4"

[dependencies.stellar-strkey]
path = ".."

[[bin]]
name = "fuzz_roundtrip"
path = "fuzz_targets/fuzz_roundtrip.rs"
test = false
doc = false
bench = false
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAC=U74P
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3ADPF7S7MGXUA74P7UJUAAAAAIAAAAAAPPAAAOWGXUA74P7UJUAAAAAIAAAAAAPPAAAOWQAAAAIAPA7A3GLR2BGMZEHXAVIRZA4KVWLTJJFC7AAAAAAAAAAAAAAAAAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MA23DKRYM6CWPA7QYNF7SOWQ
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFCJJFC7MPA7QYNF7SOWQ3GLR2GXUA7JUAAAAAEAAAAAAAAAAAAARKYBGMZQEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAEAAAAA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3ADPA7QYNFD7S7MXUA74P7UJUAAAAAQKVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCWQ3GLR2BGAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAYIBEFAWDANGXUA74P7UJUAAAAAIAAAAAMMAD5MAAPP3AAQKVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCWQ3GLR2BGAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAYIBEFAWDANGXUA74P7UJUAAAAAIAAAAAMMAD5MAAPP35SKAOAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAAAACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P7U7MXUA74P7UJUAAAAAQACAQDAQCQBYMIBEFAWDANBYHRAEIYCAAAAQACAQDAQCQBYMI5SKAOAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAAAACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P7U7MXUA74P7UJUAAAAAQACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P7UJUAAAAAQACAQDAJUAAAAAQACAQDAPPAAAOWQ3IRZA4KVWLTJR2MGXUD74P7U7MXUA74P7UJUAAAAAQACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P7UJUAAAAAQACAQDAJUAAAAAQACAQDAPPAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXURZA4KVWLTJJF7CMGAUX74P7UJFC7MGXURZA4KVWLTJJF7CMGAUX74P7UJUAAAAA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAQYNHF6AAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MA2D5KAOCICAANF7SOAU3AAB=U
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GSPAM7QQG=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3GLR2SOWQ3GLR2BGMZEHAAAAAAAAAAAAAAAAAAAAAAAAAAPA7QYNF7SOWQ3GLR2SOWQ3GLR2BGMZEHAAAPA7QYNF7SOWQ3GLR2SOWQ3GLR2BGMZEHAAAAA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LLLLE7ELLLLLL==
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7R=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7Q53G=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LLLLLLLLLLLLLLLLLLJUK===
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCMKBKFQXDAMRUGY4MKBKFQXDAMRUGY4DUPB6IBZGM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
M3ADPPA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAC=74P
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PAGGMA7VLM7QYNF7JJFC7MZEHXWLTGXUA74P7JJU
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LLLDL=L
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3ADPA7QYNF7S7MGXUA74P7UJUAAAAAIAAAAAAPPAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAAAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3G2BGMZEHXAVIR
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3ADPA7QYNF7S7MEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAQACAQDAQCQMBYIBEFAWDANBYHRAEISCWQ3GLR2BGAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAYIBEFAWDANGXUA74P7UJUAAAAAIAAAAAMMAD5MAAPP35SKAOAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAAAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3LTJJFC7MGXUA74P7UJUAAAAAOQCAADPA6QYNFD7S7MXUA74P7UJUAAAAAQACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P77UJUAAAAAIAAAAAAPPQADCOQAQCQMBYIBEFAWDANAAAAAAAAAAAAAAAAAAAQYNBYHRAEISCHF6AAMKBKFQKBXDAMRUG5Y4DUAAAAFGBU
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNFZEHXAVIAAAAAAAAAAAAAAAAAAAAKB4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LLLLLLLLLLLLLLLLLLLLLLLLLLJUK===
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MA2D5KAOCICAANF7SOAU3AAB=UAAA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
I3ADPA7QYNFD7S7MXUA74P7UJUAAAAAQACAQDAQCQBYMIBEFAWDANBYHRAEIYCWQ3GLR2MGXUD74P7UJUAAAAAQACAQDAPPAAAOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXURZA4KVWLTJJFC7MGXUA74P7UJUAAAAA74P7UJUAAAAAIAAAAAAPPAAAAAAAAAAAAAAAAAAAQYNHF6AAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MRAPAI=
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MA3D5M7CGA7Q53AAG=LGAAAAPM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CAYRE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
=D
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAPA2RXU
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MA3D5M7CGA7Q53AAG=LGAAAAPM�AA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3G2BGMZEHXAVIR��
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SBU2RXUA74
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PVIRZA4KVTLJWJFC7MGXUA74PZ7UJUA�IGM
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPUJUAAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAKB5
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CARRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR3D5KRYM6CB7OWQ6TWYRPCA
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IB=A
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAOQCAA4KVWLTJJFCJJFC7MPA7QYNF7SOWQ3GLR2GXUA7JUAAAAAEAAAAU
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SBU2RRGLXGLXH3E5CQHTD3ODLDF2BWDC
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XAGGQYNGA77OFC7V7OFCZJUM
Loading

0 comments on commit 67b79ae

Please sign in to comment.