Skip to content

Commit

Permalink
SFT-UNKN: Add foundation-psbt fuzz tests.
Browse files Browse the repository at this point in the history
Signed-off-by: Jean-Pierre De Jesus DIAZ <[email protected]>
  • Loading branch information
jeandudey committed Oct 26, 2023
1 parent 08c9b33 commit 69287cb
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ members = [
"codecs",
"ffi",
"psbt",
"psbt/fuzz",
"test-vectors",
"ur",
"urtypes",
Expand All @@ -30,6 +31,7 @@ either = { version = "1", default-features = false }
foundation-arena = { path = "arena" }
foundation-bip32 = { path = "bip32" }
foundation-codecs = { path = "codecs" }
foundation-psbt = { path = "psbt" }
foundation-test-vectors = { path = "test-vectors" }
foundation-urtypes = { path = "urtypes" }
heapless = { version = "0.8", git = "https://github.com/japaric/heapless", default-features = false }
Expand Down
40 changes: 40 additions & 0 deletions psbt/fuzz/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <[email protected]>
# SPDX-License-Identifier: GPL-3.0-or-later

[package]
name = "foundation-psbt-fuzz"
version = "0.0.0"
publish = false
edition = "2021"

[package.metadata]
cargo-fuzz = true

[dependencies]
foundation-psbt = { workspace = true }
libfuzzer-sys = { workspace = true }
nom = { workspace = true }

[[bin]]
name = "compact_size"
path = "fuzz_targets/compact_size.rs"
test = false
doc = false

[[bin]]
name = "global_key"
path = "fuzz_targets/global_key.rs"
test = false
doc = false

[[bin]]
name = "global_key_pair"
path = "fuzz_targets/global_key_pair.rs"
test = false
doc = false

[[bin]]
name = "partially_signed_bitcoin_transaction"
path = "fuzz_targets/partially_signed_bitcoin_transaction.rs"
test = false
doc = false
10 changes: 10 additions & 0 deletions psbt/fuzz/fuzz_targets/compact_size.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#![no_main]

use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
foundation_psbt::parser::global_key::<nom::error::VerboseError<_>>(data).ok();
});
10 changes: 10 additions & 0 deletions psbt/fuzz/fuzz_targets/global_key.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#![no_main]

use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
foundation_psbt::parser::global_key::<nom::error::VerboseError<_>>(data).ok();
});
10 changes: 10 additions & 0 deletions psbt/fuzz/fuzz_targets/global_key_pair.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#![no_main]

use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
foundation_psbt::parser::global_key_pair::<nom::error::VerboseError<_>>(data).ok();
});
10 changes: 10 additions & 0 deletions psbt/fuzz/fuzz_targets/partially_signed_bitcoin_transaction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// SPDX-FileCopyrightText: © 2023 Foundation Devices, Inc. <[email protected]>
// SPDX-License-Identifier: GPL-3.0-or-later

#![no_main]

use libfuzzer_sys::fuzz_target;

fuzz_target!(|data: &[u8]| {
foundation_psbt::parser::partially_signed_bitcoin_transaction::<nom::error::VerboseError<_>>(data).ok();
});

0 comments on commit 69287cb

Please sign in to comment.