aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--projects/msgpack-c/Dockerfile2
-rwxr-xr-xprojects/msgpack-c/build.sh9
-rw-r--r--projects/msgpack-c/unpack_pack_fuzzer.cc21
3 files changed, 7 insertions, 25 deletions
diff --git a/projects/msgpack-c/Dockerfile b/projects/msgpack-c/Dockerfile
index d92f00fd..46727662 100644
--- a/projects/msgpack-c/Dockerfile
+++ b/projects/msgpack-c/Dockerfile
@@ -20,4 +20,4 @@ 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 unpack_pack_fuzzer.cc $SRC/
+COPY build.sh $SRC/
diff --git a/projects/msgpack-c/build.sh b/projects/msgpack-c/build.sh
index 3a28125f..df5126e6 100755
--- a/projects/msgpack-c/build.sh
+++ b/projects/msgpack-c/build.sh
@@ -20,8 +20,11 @@ cmake -DCMAKE_C_COMPILER="$CC" -DCMAKE_CXX_COMPILER="$CXX" \
-DMSGPACK_CXX11=ON .
make -j$(nproc) all
-$CXX $CXXFLAGS -std=c++11 -Iinclude -I"$SRC/msgpack-c/include" \
- "$SRC/unpack_pack_fuzzer.cc" -o "$OUT/unpack_pack_fuzzer" \
- -lFuzzingEngine "$SRC/msgpack-c/libmsgpackc.a"
+for f in $SRC/msgpack-c/fuzz/*_fuzzer.cpp; do
+ fuzzer=$(basename "$f" _fuzzer.cpp)
+ $CXX $CXXFLAGS -std=c++11 -Iinclude -I"$SRC/msgpack-c/include" \
+ "$f" -o "$OUT/${fuzzer}_fuzzer" \
+ -lFuzzingEngine "$SRC/msgpack-c/libmsgpackc.a"
+done
zip -rj "$OUT/unpack_pack_fuzzer_seed_corpus.zip" "$SRC/msgpack-corpora/packed/"
diff --git a/projects/msgpack-c/unpack_pack_fuzzer.cc b/projects/msgpack-c/unpack_pack_fuzzer.cc
deleted file mode 100644
index 7f967331..00000000
--- a/projects/msgpack-c/unpack_pack_fuzzer.cc
+++ /dev/null
@@ -1,21 +0,0 @@
-#include <msgpack.hpp>
-
-extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- try {
- // NOTE(derwolfe): by default the limits are set at 2^32-1 length. I'm
- // setting these at far smaller values to avoid OOMs
- const int test_limit = 10000;
- msgpack::object_handle unpacked = msgpack::unpack(reinterpret_cast<const char *>(data),
- size,
- nullptr,
- nullptr,
- msgpack::unpack_limit(test_limit,
- test_limit,
- test_limit,
- test_limit));
- msgpack::sbuffer sbuf;
- msgpack::pack(sbuf, unpacked.get());
- } catch (...) {
- }
- return 0;
-}