Merge rust-bitcoin/rust-bitcoin#4209: Fix fuzz targets

ddb6dd520e Move module out of fuzz_target directory (Jamil Lambert, PhD)

Pull request description:

  #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 ddb6dd520e
  tcharding:
    ACK ddb6dd520e

Tree-SHA512: da05ab92cbb934ee90c2dc11b9edbb95e6ae66cbbeec1481ff2e2d225b43c59a7bf75a22578ca3f62c9fdda2ad195159e8a8d45529948382369a85c8718954b3
This commit is contained in:
merge-script 2025-03-09 15:29:24 +00:00
commit 694d926ed0
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
4 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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 &[];

5
fuzz/src/lib.rs Normal file
View File

@ -0,0 +1,5 @@
// SPDX-License-Identifier: CC0-1.0
//! # Fuzzing
pub mod fuzz_utils;