diff --git a/projects/open62541/Dockerfile b/projects/open62541/Dockerfile new file mode 100644 index 000000000..6e02b6b8f --- /dev/null +++ b/projects/open62541/Dockerfile @@ -0,0 +1,23 @@ +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +FROM gcr.io/oss-fuzz-base/base-builder +MAINTAINER git@s.profanter.me +RUN apt-get update && apt-get install -y make cmake +RUN git clone --depth 1 https://github.com/open62541/open62541.git -bfeature/fuzzing open62541 +WORKDIR open62541 +RUN git submodule update --init --recursive +COPY build.sh $SRC/ diff --git a/projects/open62541/build.sh b/projects/open62541/build.sh new file mode 100755 index 000000000..c378f3a06 --- /dev/null +++ b/projects/open62541/build.sh @@ -0,0 +1,62 @@ +#!/bin/bash -eu +# Copyright 2016 Google Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +################################################################################ + +mkdir -p $WORK/open62541 +cd $WORK/open62541 + +cmake -DCMAKE_BUILD_TYPE=Debug -DUA_ENABLE_AMALGAMATION=OFF \ + -DBUILD_SHARED_LIBS=OFF -DUA_BUILD_EXAMPLES=OFF -DUA_LOGLEVEL=400 \ + -DUA_ENABLE_DISCOVERY=ON -DUA_ENABLE_DISCOVERY_MULTICAST=ON \ + $SRC/open62541/ + +# for now just use one processor, otherwise amalgamation may fail +make -j1 + +# ------------------------------------------------------------ +# Add additional definitions which are normally set with CMake +# ------------------------------------------------------------ + +# Definitions +CFLAGS="$CFLAGS -DUA_NO_AMALGAMATION" +# Include dirs +CFLAGS="$CFLAGS -I$WORK/open62541/src_generated -I$SRC/open62541/include -I$SRC/open62541/plugins -I$SRC/open62541/deps -I$SRC/open62541/src -I$SRC/open62541/src/server" + +# ------------------------------------------------------------ +# Build all the fuzzing targets in tests/fuzz +# ------------------------------------------------------------ + +fuzzerFiles=$(find $SRC/open62541/tests/fuzz/ -name "*.c") + +for F in $fuzzerFiles; do + fuzzerName=$(basename $F .c) + echo "Building fuzzer $fuzzerName" + + $CC $CFLAGS -c \ + $F -o $OUT/${fuzzerName}.o + + $CXX $CXXFLAGS \ + $OUT/${fuzzerName}.o -o $OUT/${fuzzerName} \ + -lFuzzingEngine -L $WORK/open62541/bin -lopen62541 + + if [ -d "$SRC/open62541/tests/fuzz/${fuzzerName}_corpus" ]; then + zip -j $OUT/${fuzzerName}_seed_corpus.zip $SRC/open62541/tests/fuzz/${fuzzerName}_corpus/* + fi +done + +cp $SRC/open62541/tests/fuzz/*.dict $SRC/open62541/tests/fuzz/*.options $OUT/ + +echo "Built all fuzzer targets." diff --git a/projects/open62541/project.yaml b/projects/open62541/project.yaml new file mode 100644 index 000000000..7504d1d8e --- /dev/null +++ b/projects/open62541/project.yaml @@ -0,0 +1,10 @@ +homepage: "https://open62541.org/" +primary_contact: "git@s.profanter.me" +auto_ccs: + - "julius.pfrommer@iosb.fraunhofer.de" + - "f.palm@plt.rwth-aachen.de" + - "chris_paul.iatrou@tu-dresden.de" +sanitizers: +- address +- undefined +- memory \ No newline at end of file