From d13f04996ccf7c99577b2e1eadb68156d5b218b8 Mon Sep 17 00:00:00 2001 From: DavidKorczynski Date: Thu, 12 May 2022 11:10:02 +0100 Subject: [PATCH] opendnp3: fix build (#7696) * opendnp3: fix build * disable leaks * nit * remove export ASAN_OPTIONS --- projects/opendnp3/Dockerfile | 2 +- projects/opendnp3/build.sh | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/projects/opendnp3/Dockerfile b/projects/opendnp3/Dockerfile index e602568f5..2152ff060 100644 --- a/projects/opendnp3/Dockerfile +++ b/projects/opendnp3/Dockerfile @@ -17,6 +17,6 @@ FROM gcr.io/oss-fuzz-base/base-builder RUN apt-get update && apt-get install -y make wget tshark -RUN git clone --recursive -b release-2.x --depth 1 https://github.com/dnp3/opendnp3.git opendnp3 +RUN git clone --recursive -b release --depth 1 https://github.com/dnp3/opendnp3.git opendnp3 WORKDIR opendnp3 COPY build.sh $SRC/ diff --git a/projects/opendnp3/build.sh b/projects/opendnp3/build.sh index d7973fabd..93c1f8f8e 100755 --- a/projects/opendnp3/build.sh +++ b/projects/opendnp3/build.sh @@ -16,10 +16,7 @@ ################################################################################ # build project -cmake -DDNP3_FUZZING=ON -DSTATICLIBS=ON . - -# We must set AFL_LLVM_INSTRUMENT as otherwise the build fails with AFL -export AFL_LLVM_INSTRUMENT=CLASSIC,CTX-2 +cmake -DDNP3_FUZZING=ON -DDNP3_STATIC_LIBS=ON . make all cd cpp/tests/fuzz @@ -28,6 +25,7 @@ TARGETS="fuzzdecoder \ fuzzoutstation \ fuzzmaster" +echo "detect_leaks=0" >> fuzzdnp3.options for target in $TARGETS; do # build corpus zip -r ${target}_seed_corpus.zip corpus/*.dnp @@ -37,6 +35,9 @@ for target in $TARGETS; do cp fuzzdnp3.options $OUT/${target}.options # build fuzz target - $CXX $CXXFLAGS -I. -I ../../libs/include/ -I ../../tests/libs/src/ -I ../../libs/src/ -c ${target}.cpp -o ${target}.o - $CXX $CXXFLAGS -std=c++14 ${target}.o -o $OUT/${target} ../../../libdnp3mocks.a ../../../libtestlib.a ../../../libasiodnp3.a ../../../libdnp3decode.a ../../../libasiopal.a ../../../libopendnp3.a ../../../libopenpal.a $LIB_FUZZING_ENGINE + $CXX $CXXFLAGS -I. -I ../../lib/include/ -I ../../tests/lib/src/ \ + -I ../../lib/src/ -I ../../../_deps/exe4cpp-src/src/ -I ../dnp3mocks/include/ \ + -I ../../../_deps/ser4cpp-src/src/ -I ../../../_deps/asio-src/asio/include \ + -c ${target}.cpp -o ${target}.o + $CXX $CXXFLAGS -std=c++14 ${target}.o -o $OUT/${target} ../dnp3mocks/libdnp3mocks.a ../../lib/libopendnp3.a $LIB_FUZZING_ENGINE done