aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/wpantund
diff options
context:
space:
mode:
authorGravatar Robert Quattlebaum <darco@deepdarc.com>2017-09-15 14:40:48 -0700
committerGravatar Oliver Chang <oliverchang@users.noreply.github.com>2017-09-15 14:40:48 -0700
commitd3bf62852b3f74d7b4dceee2e5a176a577f9ddba (patch)
treedf7ab0fa384c989a4aed5c4a2c8555fcf6af9f80 /projects/wpantund
parentbf774e525ff6b3c02b162d48db80f309d567a66f (diff)
Adds wpantund (part of OpenThread) to oss-fuzz. (#843)
Diffstat (limited to 'projects/wpantund')
-rw-r--r--projects/wpantund/Dockerfile36
-rwxr-xr-xprojects/wpantund/build.sh57
-rw-r--r--projects/wpantund/project.yaml2
3 files changed, 95 insertions, 0 deletions
diff --git a/projects/wpantund/Dockerfile b/projects/wpantund/Dockerfile
new file mode 100644
index 00000000..2f0efbaa
--- /dev/null
+++ b/projects/wpantund/Dockerfile
@@ -0,0 +1,36 @@
+# Copyright 2017 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 rquattle@google.com
+
+RUN apt-get -y update \
+ && DEBIAN_FRONTEND=noninteractive \
+ apt-get install -y -q --no-install-recommends \
+ gdb \
+ libdbus-1-dev \
+ libboost-dev \
+ pkg-config \
+ libtool \
+ autoconf \
+ autoconf-archive \
+ automake
+
+COPY build.sh *.options $SRC/
+
+RUN git clone --depth 1 https://github.com/openthread/wpantund
+
+WORKDIR wpantund
diff --git a/projects/wpantund/build.sh b/projects/wpantund/build.sh
new file mode 100755
index 00000000..0c763276
--- /dev/null
+++ b/projects/wpantund/build.sh
@@ -0,0 +1,57 @@
+#!/bin/bash -eu
+# Copyright 2017 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.
+#
+################################################################################
+
+# Wpantund's configure script is fuzzer-aware, so we
+# move those flags into their own environment variables.
+FUZZ_CFLAGS="${CFLAGS}"
+FUZZ_CXXFLAGS="${CXXFLAGS}"
+unset CFLAGS
+unset CXXFLAGS
+
+./bootstrap.sh
+
+./configure \
+ --enable-fuzz-targets \
+ --disable-shared \
+ --enable-static \
+ CC="${CC}" \
+ CXX="${CXX}" \
+ FUZZ_LIBS="${LIB_FUZZING_ENGINE}" \
+ FUZZ_CFLAGS="${FUZZ_CFLAGS}" \
+ FUZZ_CXXFLAGS="${FUZZ_CXXFLAGS}" \
+ LDFLAGS="-lpthread" \
+ CXXFLAGS="-stdlib=libc++"
+
+# Build everything.
+make -j$(nproc)
+
+# Copy all fuzzers and related options/dictionaries.
+find . -name '*[-_]fuzz' -type f -exec cp -v '{}' $OUT ';'
+find . -name '*[-_]fuzz.dict' -type f -exec cp -v '{}' $OUT ';'
+find . -name '*[-_]fuzz.options' -type f -exec cp -v '{}' $OUT ';'
+
+# Copy all of the fuzzers' related corpi.
+for f in etc/fuzz-corpus/*[-_]fuzz
+do
+ fuzzer=$(basename $f)
+ if test -d "${f}"
+ then zip -j $OUT/${fuzzer}_seed_corpus.zip ${f}/*
+ fi
+done
+
+# Dump out all of the files in the output.
+find $OUT -type f > /dev/stderr
diff --git a/projects/wpantund/project.yaml b/projects/wpantund/project.yaml
new file mode 100644
index 00000000..48aa96d2
--- /dev/null
+++ b/projects/wpantund/project.yaml
@@ -0,0 +1,2 @@
+homepage: "https://github.com/openthread/wpantund"
+primary_contact: "rquattle@google.com"