Adds wpantund (part of OpenThread) to oss-fuzz. (#843)

This commit is contained in:
Robert Quattlebaum 2017-09-15 14:40:48 -07:00 committed by Oliver Chang
parent bf774e525f
commit d3bf62852b
3 changed files with 95 additions and 0 deletions

View File

@ -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

57
projects/wpantund/build.sh Executable file
View File

@ -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

View File

@ -0,0 +1,2 @@
homepage: "https://github.com/openthread/wpantund"
primary_contact: "rquattle@google.com"