From 36de5d7b2977225940cfc01a7b660efe982d7679 Mon Sep 17 00:00:00 2001 From: Chris Wolfe Date: Thu, 26 Apr 2018 09:16:39 -0500 Subject: [PATCH] [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 --- projects/msgpack-c/Dockerfile | 1 - projects/msgpack-c/build.sh | 13 +++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/projects/msgpack-c/Dockerfile b/projects/msgpack-c/Dockerfile index 46727662a..4dea0b34e 100644 --- a/projects/msgpack-c/Dockerfile +++ b/projects/msgpack-c/Dockerfile @@ -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/ diff --git a/projects/msgpack-c/build.sh b/projects/msgpack-c/build.sh index df5126e6a..03e0604ae 100755 --- a/projects/msgpack-c/build.sh +++ b/projects/msgpack-c/build.sh @@ -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