2020-12-16 13:30:36 +01:00
|
|
|
#!/bin/bash -eu
|
|
|
|
|
2022-09-02 00:20:17 +02:00
|
|
|
git submodule update --init --depth 1 thirdparty
|
|
|
|
|
2020-12-16 13:30:36 +01:00
|
|
|
# This line causes an abort which breaks fuzzing:
|
|
|
|
sed -i '27d' include/valijson/utils/rapidjson_utils.hpp
|
|
|
|
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2022-02-04 01:00:17 +01:00
|
|
|
cmake \
|
|
|
|
-Dvalijson_BUILD_TESTS=TRUE \
|
|
|
|
-Dvalijson_BUILD_EXAMPLES=FALSE \
|
2020-12-16 13:30:36 +01:00
|
|
|
-Dvalijson_EXCLUDE_BOOST=TRUE \
|
|
|
|
..
|
|
|
|
|
2022-01-06 23:02:02 +01:00
|
|
|
make -j"$(nproc)"
|
2020-12-16 13:30:36 +01:00
|
|
|
|
|
|
|
cd ../tests/fuzzing
|
|
|
|
|
|
|
|
find ../.. -name "*.o" -exec ar rcs fuzz_lib.a {} \;
|
|
|
|
|
2022-01-06 23:02:02 +01:00
|
|
|
# CXXFLAGS may contain spaces
|
|
|
|
# shellcheck disable=SC2086
|
|
|
|
"$CXX" $CXXFLAGS -DVALIJSON_USE_EXCEPTIONS=1 \
|
2022-08-30 01:54:37 +02:00
|
|
|
-I/src/valijson/thirdparty/rapidjson/include \
|
|
|
|
-I/src/valijson/thirdparty/rapidjson/include/rapidjson \
|
2020-12-16 13:30:36 +01:00
|
|
|
-I/src/valijson/include \
|
|
|
|
-I/src/valijson/include/valijson \
|
|
|
|
-I/src/valijson/include/valijson/adapters \
|
|
|
|
-c fuzzer.cpp -o fuzzer.o
|
|
|
|
|
2022-01-06 23:02:02 +01:00
|
|
|
# shellcheck disable=SC2086
|
|
|
|
"$CXX" $CXXFLAGS "$LIB_FUZZING_ENGINE" \
|
2020-12-16 13:30:36 +01:00
|
|
|
-DVALIJSON_USE_EXCEPTIONS=1 \
|
|
|
|
-rdynamic fuzzer.o \
|
2022-01-09 21:35:04 +01:00
|
|
|
-o "${OUT}/fuzzer" fuzz_lib.a
|
2020-12-16 13:30:36 +01:00
|
|
|
|
2022-01-06 23:02:02 +01:00
|
|
|
zip "${OUT}/fuzzer_seed_corpus.zip" \
|
|
|
|
"${SRC}/valijson/doc/schema/draft-03.json"
|