Skip to content

Commit 48c33e8

Browse files
authored
Correctly restore unstable encoding corpus and create tokio runtime only once per process (#8480)
1 parent cb82828 commit 48c33e8

2 files changed

Lines changed: 10 additions & 8 deletions

File tree

.github/workflows/run-fuzzer.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ jobs:
116116
- name: Run fuzzing target
117117
id: fuzz
118118
run: |
119+
CORPUS_DIR="fuzz/corpus/${FUZZ_NAME}"
119120
FEATURES_FLAG=""
120121
if [ -n "${{ inputs.extra_features }}" ]; then
121122
FEATURES_FLAG="--features ${{ inputs.extra_features }}"
@@ -127,7 +128,7 @@ jobs:
127128
${{ inputs.extra_env }} RUST_BACKTRACE=1 \
128129
cargo +$NIGHTLY_TOOLCHAIN fuzz run --release --debug-assertions \
129130
$FEATURES_FLAG \
130-
${{ inputs.fuzz_target }} -- \
131+
${{ inputs.fuzz_target }} "$CORPUS_DIR" -- \
131132
$FORK_FLAG -max_total_time=${{ inputs.max_time }} -rss_limit_mb=0 \
132133
2>&1 | tee fuzz_output.log
133134
continue-on-error: true

fuzz/fuzz_targets/compress_gpu.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,21 @@
44
#![no_main]
55
#![expect(clippy::unwrap_used)]
66

7+
use std::sync::LazyLock;
8+
79
use libfuzzer_sys::Corpus;
810
use libfuzzer_sys::fuzz_target;
11+
use tokio::runtime::Builder;
12+
use tokio::runtime::Runtime;
913
use vortex_error::vortex_panic;
1014
use vortex_fuzz::FuzzCompressGpu;
1115
use vortex_fuzz::run_compress_gpu;
1216

13-
fuzz_target!(|fuzz: FuzzCompressGpu| -> Corpus {
14-
// Use tokio runtime to run async GPU fuzzer
15-
let rt = tokio::runtime::Builder::new_current_thread()
16-
.enable_all()
17-
.build()
18-
.unwrap();
17+
static RUNTIME: LazyLock<Runtime> =
18+
LazyLock::new(|| Builder::new_current_thread().enable_all().build().unwrap());
1919

20-
match rt.block_on(run_compress_gpu(fuzz)) {
20+
fuzz_target!(|fuzz: FuzzCompressGpu| -> Corpus {
21+
match RUNTIME.block_on(run_compress_gpu(fuzz)) {
2122
Ok(true) => Corpus::Keep,
2223
Ok(false) => Corpus::Reject,
2324
Err(e) => {

0 commit comments

Comments
 (0)