Skip to content

Commit a71ecc6

Browse files
committed
wip
1 parent 9e0d1bb commit a71ecc6

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

.github/workflows/wasm-fuzz.yml

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
name: WASM Fuzz
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
fuzz_duration:
7-
description: "Fuzzing duration in hours"
8-
required: false
9-
default: "4"
10-
type: string
114
schedule:
125
# Run daily at 2 AM UTC
136
- cron: "0 2 * * *"
@@ -65,32 +58,40 @@ jobs:
6558
echo "hours=$HOURS" >> $GITHUB_OUTPUT
6659
6760
- name: Run wasmfuzz
61+
id: fuzz
6862
run: |
69-
mkdir -p corpus
63+
mkdir -p corpus-wasm
64+
# Capture exit code - wasmfuzz exits with error on crash
65+
set +e
7066
wasmfuzz fuzz \
7167
--timeout="${{ steps.duration.outputs.hours }}h" \
7268
--cores 2 \
73-
--dir corpus/ \
69+
--dir corpus-wasm/ \
7470
target/wasm32-wasip1/release/array_ops_wasm.wasm
71+
FUZZ_EXIT=$?
72+
set -e
73+
echo "exit_code=$FUZZ_EXIT" >> $GITHUB_OUTPUT
74+
if [ $FUZZ_EXIT -ne 0 ]; then
75+
echo "crash_found=true" >> $GITHUB_OUTPUT
76+
fi
77+
78+
- name: Replay crash inputs
79+
if: steps.fuzz.outputs.crash_found == 'true'
80+
run: |
81+
echo "::error::Crash found during fuzzing! Replaying inputs for debug output..."
82+
for input in corpus-wasm/*; do
83+
echo "=== Replaying: $input ==="
84+
wasmfuzz run --trace target/wasm32-wasip1/release/array_ops_wasm.wasm "$input" || true
85+
done
7586
7687
- name: Upload corpus
88+
if: always()
7789
uses: actions/upload-artifact@v4
7890
with:
79-
name: fuzz-corpus
80-
path: corpus/
91+
name: corpus-wasm
92+
path: corpus-wasm/
8193
retention-days: 30
8294

83-
- name: Check for crashes
84-
run: |
85-
if [ -d "crashes" ] && [ "$(ls -A crashes 2>/dev/null)" ]; then
86-
echo "::error::Crashes found during fuzzing!"
87-
ls -la crashes/
88-
exit 1
89-
fi
90-
91-
- name: Upload crashes
92-
uses: actions/upload-artifact@v4
93-
with:
94-
name: fuzz-crashes
95-
path: crashes/
96-
retention-days: 90
95+
- name: Fail if crash found
96+
if: steps.fuzz.outputs.crash_found == 'true'
97+
run: exit 1

0 commit comments

Comments
 (0)