-
Notifications
You must be signed in to change notification settings - Fork 146
Expand file tree
/
Copy pathbuild-wasmfuzz.sh
More file actions
executable file
·53 lines (46 loc) · 1.65 KB
/
build-wasmfuzz.sh
File metadata and controls
executable file
·53 lines (46 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright the Vortex contributors
#!/bin/bash
# Build the vortex-fuzz crate for wasmfuzz
#
# This script builds the fuzzer binary for the wasm32-wasip1 target,
# which can then be used with wasmfuzz for coverage-guided fuzzing.
#
# Prerequisites:
# - Nightly Rust toolchain (for -Z flags)
# - wasm32-wasip1 target: rustup +nightly target add wasm32-wasip1
# - wasmfuzz: cargo install --git https://github.com/CISPA-SysSec/wasmfuzz
#
# Usage:
# ./build-wasmfuzz.sh
#
# After building, run with wasmfuzz:
# wasmfuzz fuzz --timeout=1h --cores 8 --dir corpus/ \
# target/wasm32-wasip1/release/array_ops_wasm.wasm
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR/.."
echo "Building vortex-fuzz for wasm32-wasip1..."
# Build the WASM binary with nightly for -Z flags (build-std, embed-source, etc.)
rustup run nightly cargo build \
--manifest-path fuzz/Cargo.toml \
--target wasm32-wasip1 \
--no-default-features \
--features wasmfuzz \
--release \
--bin array_ops_wasm
WASM_OUTPUT="target/wasm32-wasip1/release/array_ops_wasm.wasm"
if [ -f "$WASM_OUTPUT" ]; then
echo ""
echo "Build successful!"
echo "Output: $WASM_OUTPUT"
echo ""
echo "To run with wasmfuzz:"
echo " wasmfuzz fuzz --timeout=1h --cores 8 --dir corpus/ $WASM_OUTPUT"
echo ""
echo "See: https://github.com/CISPA-SysSec/wasmfuzz"
else
echo "Build completed but .wasm output not found at expected location."
echo "Check target/wasm32-wasip1/release/ for outputs:"
ls -la target/wasm32-wasip1/release/ 2>/dev/null || echo "Directory not found"
fi