Skip to content

Commit 9dce262

Browse files
committed
fix(fuzz): restrict ClusterFuzzLite to the address sanitizer
cargo-fuzz builds Rust fuzz targets with AddressSanitizer hard-coded and ignores $SANITIZER, so the undefined/memory matrix legs produced ASan binaries that OSS-Fuzz bad_build_check rejected: BAD BUILD: UBSan build of fuzz_glob_expansion seems to be compiled with ASan Advertise and build only the address sanitizer, which is the set cargo-fuzz actually supports for Rust and already covers the relevant memory-safety classes. build.sh now honours $SANITIZER (defaulting to address) so the requested and produced sanitizer always agree. - .clusterfuzzlite/project.yaml: sanitizers -> [address] - cflite_pr.yml / cflite_batch.yml: matrix sanitizer -> [address] - build.sh: cargo +nightly fuzz build --sanitizer ${SANITIZER:-address} Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KfgJznd6jzSeDYsSXGAXkU
1 parent ec55ef9 commit 9dce262

4 files changed

Lines changed: 14 additions & 6 deletions

File tree

.clusterfuzzlite/build.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ if ! command -v cargo-fuzz >/dev/null 2>&1; then
1717
RUSTFLAGS="" cargo install cargo-fuzz --locked
1818
fi
1919

20-
# Build all fuzz targets
21-
cargo +nightly fuzz build
20+
# Build all fuzz targets. cargo-fuzz only supports the address sanitizer for
21+
# Rust; honour $SANITIZER when set (OSS-Fuzz exports it) but default to address.
22+
cargo +nightly fuzz build --sanitizer "${SANITIZER:-address}"
2223

2324
# Copy fuzz targets to $OUT
2425
for target in fuzz/target/*/release/fuzz_*; do

.clusterfuzzlite/project.yaml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,13 @@ primary_contact: "jonathan.jewell@open.ac.uk"
77
auto_ccs:
88
- "jonathan.jewell@open.ac.uk"
99

10+
# Rust fuzz targets are built by cargo-fuzz, which hard-codes AddressSanitizer
11+
# and ignores $SANITIZER. Advertising `undefined`/`memory` makes OSS-Fuzz's
12+
# bad_build_check fail ("UBSan build ... seems to be compiled with ASan"),
13+
# because the produced binary is always ASan. ASan already covers Rust's
14+
# relevant memory-safety classes here, so `address` is the supported set.
1015
sanitizers:
1116
- address
12-
- undefined
13-
- memory
1417

1518
fuzzing_engines:
1619
- libfuzzer

.github/workflows/cflite_batch.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ jobs:
2424
strategy:
2525
fail-fast: false
2626
matrix:
27-
sanitizer: [address, undefined, memory]
27+
# cargo-fuzz hard-codes ASan for Rust, so only `address` yields a valid
28+
# build (see .clusterfuzzlite/project.yaml for the full rationale).
29+
sanitizer: [address]
2830
steps:
2931
- name: Checkout code
3032
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4

.github/workflows/cflite_pr.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ jobs:
2323
strategy:
2424
fail-fast: false
2525
matrix:
26-
sanitizer: [address, undefined]
26+
# cargo-fuzz hard-codes ASan for Rust, so only `address` yields a valid
27+
# build (see .clusterfuzzlite/project.yaml for the full rationale).
28+
sanitizer: [address]
2729
steps:
2830
- name: Checkout code
2931
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v4

0 commit comments

Comments
 (0)