[msgpack-c] move seeds to source repo (#1360)

* 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
This commit is contained in:
Chris Wolfe 2018-04-26 09:16:39 -05:00 committed by Max Moroz
parent 37ced73db3
commit 36de5d7b29
2 changed files with 9 additions and 5 deletions

View File

@ -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/

View File

@ -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