fuzz: detach fuzz.sh from fuzz-util.sh, use cargo-fuzz instead
What changed, and why it matters
This commit refactors a fuzz-testing shell script to stop using a local helper file and instead use the standard 'cargo-fuzz' tool directly. It is a build/test tooling change with no apparent effect on the security of the actual Bitcoin library code.
No security action needed; review as normal build-tooling cleanup if desired.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff modifies fuzz/fuzz.sh: it removes sourcing of fuzz-util.sh, replaces custom listTargetFiles/targetFileToName/checkWindowsFiles/checkReport helpers with cargo fuzz list and direct cargo-fuzz commands, and drops a Windows filename check and crash-report check. This is purely a fuzzing harness/infrastructure simplification.
Changed components
fuzz/fuzz.shInspect captured patch +7 / −23
diff --git a/fuzz/fuzz.sh b/fuzz/fuzz.sh
index eb43f8d0..e1d5d0b8 100755
--- a/fuzz/fuzz.sh
+++ b/fuzz/fuzz.sh
@@ -12,12 +12,6 @@
set -euox pipefail
-REPO_DIR=$(git rev-parse --show-toplevel)
-
-# can't find the file because of the ENV var
-# shellcheck source=/dev/null
-source "$REPO_DIR/fuzz/fuzz-util.sh"
-
target=
max_total_time=
cycle_mode=false
@@ -60,24 +54,19 @@ case "$max_total_time" in
;;
esac
-# Check that input files are correct Windows file names
-checkWindowsFiles
+cargo --version
+rustc --version
+cargo install --force --locked --version 0.12.0 cargo-fuzz
if [ -z "$target" ]; then
- targetFiles="$(listTargetFiles)"
+ targets=$(cargo fuzz list)
else
- targetFiles=fuzz_targets/"$target".rs
+ targets="$target"
fi
-cargo --version
-rustc --version
-
-cargo install --force --locked --version 0.12.0 cargo-fuzz
while :; do
- for targetFile in $targetFiles; do
- targetName=$(targetFileToName "$targetFile")
-
- echo "Fuzzing target $targetName ($targetFile) for $max_total_time seconds"
+ for targetName in $targets; do
+ echo "Fuzzing target $targetName for $max_total_time seconds"
# Enable fuzz stubs in the hashes and cryptography libraries by default,
# unless we are fuzzing the hashes targets themselves.
fuzz_rustflags=''
@@ -94,11 +83,6 @@ while :; do
echo "Minimizing corpus for target $targetName"
cargo +nightly fuzz cmin "$targetName"
-
- # Check for artifacts/crashes in normal mode.
- if [ "$cycle_mode" = false ]; then
- checkReport "$targetName"
- fi
done
# Exit after one cycle if not in cycle mode.
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.