Skip to content

Commit

Permalink
[msgpack-c] move seeds to source repo (#1360)
Browse files Browse the repository at this point in the history
* remove fetching seeds from my corpus, fetch instead from src repo

* conditionally zip up fuzzer seed corpora for any fuzzer passed in

* Simplify build steps

We already know that the fuzzers are being iterated over due to the loop
and globbing. As such, we can use more of the fuzzer name and reduce
repetition. This should allow us to add fuzzers/corpora to the src repo
and no need to change anything about the build script or dockerfile
  • Loading branch information
derwolfe authored and Dor1s committed Apr 26, 2018
1 parent 37ced73 commit 36de5d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
1 change: 0 additions & 1 deletion projects/msgpack-c/Dockerfile
Expand Up @@ -18,6 +18,5 @@ FROM gcr.io/oss-fuzz-base/base-builder
MAINTAINER chriswwolfe@gmail.com
RUN apt-get update && apt-get install -y cmake
RUN git clone --depth 1 https://github.com/msgpack/msgpack-c.git msgpack-c
RUN git clone --depth 1 https://github.com/derwolfe/msgpack-corpora.git msgpack-corpora
WORKDIR msgpack-c
COPY build.sh $SRC/
13 changes: 9 additions & 4 deletions projects/msgpack-c/build.sh
Expand Up @@ -21,10 +21,15 @@ cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \
make -j$(nproc) all

for f in $SRC/msgpack-c/fuzz/*_fuzzer.cpp; do
fuzzer=$(basename "$f" _fuzzer.cpp)
# NOTE(derwolfe): the naming scheme for fuzzers and seed corpora is
# fuzzer = something_something_fuzzer.cpp
# seed corpus = something_something_fuzzer_seed_corpus
fuzzer=$(basename "$f" .cpp)
$CXX $CXXFLAGS -std=c++11 -Iinclude -I"$SRC/msgpack-c/include" \
"$f" -o "$OUT/${fuzzer}_fuzzer" \
"$f" -o "$OUT/${fuzzer}" \
-lFuzzingEngine "$SRC/msgpack-c/libmsgpackc.a"
done

zip -rj "$OUT/unpack_pack_fuzzer_seed_corpus.zip" "$SRC/msgpack-corpora/packed/"
if [ -d "$SRC/msgpack-c/fuzz/${fuzzer}_seed_corpus" ]; then
zip -rj "$OUT/${fuzzer}_seed_corpus.zip" "$SRC/msgpack-c/fuzz/${fuzzer}_seed_corpus/"
fi
done

0 comments on commit 36de5d7

Please sign in to comment.