aboutsummaryrefslogtreecommitdiff
path: root/projects/upb
diff options
context:
space:
mode:
authorGoogle AutoFuzz Team <security-tps@google.com>2019-06-26 15:42:50 -0400
committerMax Moroz <mmoroz@chromium.org>2019-06-26 12:42:50 -0700
commitd5992e4ef57ef2493c160fb22de1ce8542041f35 (patch)
tree9618fad711547f6c331744e5c247aad9cb2cf850 /projects/upb
parented51f6616d279e595e822e20c4c0962c42e0431f (diff)
downloadoss-fuzz-d5992e4ef57ef2493c160fb22de1ce8542041f35.tar.gz
[upb] New Project: upb (#2538)
* Create build.sh * Create Dockerfile * Create project.yaml * Modified Dockerfile and build.sh * Made changes to the build.sh * Made changes to build * Modified build * updated build and project files * Update project.yaml
Diffstat (limited to 'projects/upb')
-rw-r--r--projects/upb/Dockerfile36
-rw-r--r--projects/upb/build.sh55
-rw-r--r--projects/upb/project.yaml4
3 files changed, 95 insertions, 0 deletions
diff --git a/projects/upb/Dockerfile b/projects/upb/Dockerfile
new file mode 100644
index 000000000..95b763503
--- /dev/null
+++ b/projects/upb/Dockerfile
@@ -0,0 +1,36 @@
+# Copyright 2019 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 haberman@google.com
+
+RUN apt-get update && apt-get install -y --no-install-recommends \
+ curl \
+ python-dev \
+ python-future \
+ rsync \
+ && \
+ apt-get clean && \
+ rm -rf /var/lib/apt/lists/*
+
+# Install Bazel from apt-get to ensure dependencies are there
+RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
+RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
+RUN apt-get update && apt-get install -y bazel
+
+RUN git clone --depth 1 https://github.com/protocolbuffers/upb.git upb
+WORKDIR upb
+COPY build.sh $SRC/
diff --git a/projects/upb/build.sh b/projects/upb/build.sh
new file mode 100644
index 000000000..a97a51330
--- /dev/null
+++ b/projects/upb/build.sh
@@ -0,0 +1,55 @@
+#!/bin/bash -eu
+# Copyright 2019 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.
+#
+################################################################################
+FUZZER_DICTIONARIES="\
+"
+
+NO_VPTR="--copt=-fno-sanitize=vptr --linkopt=-fno-sanitize=vptr"
+EXTRA_BAZEL_FLAGS="--strip=never $(for f in $CXXFLAGS; do if [ $f != "-stdlib=libc++" ] ; then echo --copt=$f --linkopt=$f; fi; done)"
+bazel build --dynamic_mode=off --spawn_strategy=standalone --genrule_strategy=standalone \
+ --verbose_failures \
+ $EXTRA_BAZEL_FLAGS \
+ $NO_VPTR \
+ -k \
+ :file_descriptor_parsenew_fuzzer
+
+# Copied from projects/envoy/build.sh which also uses Bazel.
+# Profiling with coverage requires that we resolve+copy all Bazel symlinks and
+# also remap everything under proc/self/cwd to correspond to Bazel build paths.
+if [ "$SANITIZER" = "coverage" ]
+then
+ # The build invoker looks for sources in $SRC, but it turns out that we need
+ # to not be buried under src/, paths are expected at out/proc/self/cwd by
+ # the profiler.
+ declare -r REMAP_PATH="${OUT}/proc/self/cwd"
+ mkdir -p "${REMAP_PATH}"
+ rsync -av "${SRC}"/upb "${REMAP_PATH}"
+fi
+
+file=file_descriptor_parsenew_fuzzer
+echo "${file}"
+TARGET_DRIVERLESS=bazel-bin/"${file}"
+echo "copying fuzzer"
+cp "${TARGET_DRIVERLESS}" "${OUT}"/"${file}"_fuzz_test
+
+# Copy dictionaries and options files to $OUT/
+for dict in $FUZZER_DICTIONARIES; do
+ cp $dict $OUT/
+done
+
+# Don't have a consistent naming convention between fuzzer files and corpus
+# directories so we resort to hard coding zipping corpses
+zip $OUT/file_descriptor_parsenew_fuzzer_seed_corpus.zip tests/*
diff --git a/projects/upb/project.yaml b/projects/upb/project.yaml
new file mode 100644
index 000000000..b244b012f
--- /dev/null
+++ b/projects/upb/project.yaml
@@ -0,0 +1,4 @@
+homepage: "<https://github.com/protocolbuffers/upb>"
+primary_contact: "<jhaberman@gmail.com>"
+sanitizers:
+ - address