Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions projects/wasmtime/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
FROM gcr.io/oss-fuzz-base/base-builder
RUN apt-get update && apt-get install -y make autoconf automake libtool curl cmake python llvm-dev libclang-dev clang

RUN git clone --depth 1 https://github.com/bytecodealliance/wasm-tools wasm-tools

RUN git clone --depth 1 https://github.com/bytecodealliance/wasmtime wasmtime
WORKDIR wasmtime
RUN git submodule update --init --recursive
Expand Down
44 changes: 28 additions & 16 deletions projects/wasmtime/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,36 @@
################################################################################

# Note: This project creates Rust fuzz targets exclusively
PROJECT_DIR=$SRC/wasmtime

# Build with all features to enable the binaryen-using fuzz targets, and
# the peepmatic fuzz targets.
cd $PROJECT_DIR/fuzz && cargo fuzz build -O --debug-assertions --all-features
build() {
project=$1
shift
fuzzer_prefix=$1
shift
PROJECT_DIR=$SRC/$project

cd $PROJECT_DIR/fuzz && cargo fuzz build -O --debug-assertions "$@"

FUZZ_TARGET_OUTPUT_DIR=$PROJECT_DIR/target/x86_64-unknown-linux-gnu/release

FUZZ_TARGET_OUTPUT_DIR=$PROJECT_DIR/target/x86_64-unknown-linux-gnu/release
for f in $PROJECT_DIR/fuzz/fuzz_targets/*.rs
do
src_name=$(basename ${f%.*})
dst_name=$fuzzer_prefix$src_name
cp $FUZZ_TARGET_OUTPUT_DIR/$src_name $OUT/$dst_name

for f in $SRC/wasmtime/fuzz/fuzz_targets/*.rs
do
FUZZ_TARGET_NAME=$(basename ${f%.*})
cp $FUZZ_TARGET_OUTPUT_DIR/$FUZZ_TARGET_NAME $OUT/
if [[ -d $SRC/wasmtime/wasmtime-libfuzzer-corpus/$dst_name/ ]]; then
zip -jr \
$OUT/${dst_name}_seed_corpus.zip \
$SRC/wasmtime/wasmtime-libfuzzer-corpus/$dst_name/
fi

if [[ -d $PROJECT_DIR/wasmtime-libfuzzer-corpus/$FUZZ_TARGET_NAME/ ]]; then
zip -jr \
$OUT/${FUZZ_TARGET_NAME}_seed_corpus.zip \
$PROJECT_DIR/wasmtime-libfuzzer-corpus/$FUZZ_TARGET_NAME/
fi
cp $SRC/default.options $OUT/$dst_name.options
done
}

# Build with all features to enable the binaryen-using fuzz targets, and
# the peepmatic fuzz targets.
build wasmtime "" --all-features

cp $SRC/default.options $OUT/$FUZZ_TARGET_NAME.options
done
build wasm-tools wasm-tools-