Skip to content

Commit

Permalink
Provide scripts to run fuzzers on oss-fuzz
Browse files Browse the repository at this point in the history
This allows us to reuse the toolchains and fuzzers with oss-fuzz or
clusterfuzzlite.
  • Loading branch information
sudden6 committed Dec 18, 2021
1 parent d8f251b commit 710dd5e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .clusterfuzzlite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# c-toxcore Clusterfuzzlite build environment

FROM gcr.io/oss-fuzz-base/base-builder

RUN apt-get update && \
apt-get -y install --no-install-suggests --no-install-recommends \
cmake libtool autoconf automake pkg-config

RUN git clone --depth 1 --branch 1.0.18 https://github.com/jedisct1/libsodium libsodium
RUN cd libsodium && ./autogen.sh && ./configure --enable-shared=no && make && make install

# Copy your project's source code.
COPY . $SRC/c-toxcore
# Working directory for build.sh.
WORKDIR $SRC/c-toxcore
# Copy build.sh into $SRC dir.
COPY ./.clusterfuzzlite/build.sh $SRC/
21 changes: 21 additions & 0 deletions .clusterfuzzlite/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash -eu

# out of tree build
cd $WORK

ls /usr/local/lib/

# Debug build for asserts
cmake -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER="$CC" \
-DCMAKE_CXX_COMPILER="$CXX" \
-DCMAKE_C_FLAGS="$CFLAGS" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_EXE_LINKER_FLAGS="$LIB_FUZZING_ENGINE" \
-DBUILD_TOXAV=OFF -DENABLE_SHARED=NO -DBUILD_FUZZ_TESTS=ON \
-DDHT_BOOTSTRAP=OFF -DBOOTSTRAP_DAEMON=OFF $SRC/c-toxcore

# build fuzzer target
cmake --build ./ --target bootstrap_fuzzer

# copy to output files
cp $WORK/bootstrap_fuzzer $OUT/

0 comments on commit 710dd5e

Please sign in to comment.