Skip to content

Commit

Permalink
Merge rust-bitcoin#4209: Fix fuzz targets
Browse files Browse the repository at this point in the history
ddb6dd5 Move module out of fuzz_target directory (Jamil Lambert, PhD)

Pull request description:

  rust-bitcoin#4185 introduced a new file `fuzz/fuzz_targets/bitcoin/fuzz_utils.rs` which is not a valid fuzz target.  This causes the daily fuzz workflow to fail on `verify-execution`.

  Move the module to the `src/` directory. Create a `lib.rs` file.

ACKs for top commit:
  brunoerg:
    ACK ddb6dd5
  tcharding:
    ACK ddb6dd5

Tree-SHA512: da05ab92cbb934ee90c2dc11b9edbb95e6ae66cbbeec1481ff2e2d225b43c59a7bf75a22578ca3f62c9fdda2ad195159e8a8d45529948382369a85c8718954b3
  • Loading branch information
apoelstra committed Mar 9, 2025
2 parents aefcf2b + ddb6dd5 commit 694d926
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
3 changes: 1 addition & 2 deletions fuzz/fuzz_targets/bitcoin/deserialize_psbt.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use honggfuzz::fuzz;

mod fuzz_utils;
use fuzz_utils::consume_random_bytes;
use bitcoin_fuzz::fuzz_utils::consume_random_bytes;

fn do_test(data: &[u8]) {
let mut new_data = data;
Expand Down
3 changes: 1 addition & 2 deletions fuzz/fuzz_targets/bitcoin/deserialize_script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ use bitcoin::script::{self, ScriptExt as _};
use bitcoin::{FeeRate, Network};
use honggfuzz::fuzz;

mod fuzz_utils;
use fuzz_utils::{consume_random_bytes, consume_u64};
use bitcoin_fuzz::fuzz_utils::{consume_random_bytes, consume_u64};

fn do_test(data: &[u8]) {
let mut new_data = data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// SPDX-License-Identifier: CC0-1.0

//! Helper functions for fuzzing.
pub fn consume_random_bytes<'a>(data: &mut &'a [u8]) -> &'a [u8] {
if data.is_empty() {
return &[];
Expand Down
5 changes: 5 additions & 0 deletions fuzz/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// SPDX-License-Identifier: CC0-1.0

//! # Fuzzing
pub mod fuzz_utils;

0 comments on commit 694d926

Please sign in to comment.