aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects
diff options
context:
space:
mode:
authorGravatar steadmon <josh@steadmon.net>2018-11-09 15:10:24 -0800
committerGravatar Max Moroz <dor3s1@gmail.com>2018-11-09 15:10:24 -0800
commit89c53fee79bd7aabfdbc989dfab6ca4074c3acba (patch)
tree67f904e3edf8c15d54753b50f24d784a154332e8 /projects
parent6def182595551c06aa144c86a5df28ba8886f650 (diff)
[git] Add basic config for git fuzzing. (#1938)
* Add basic config for git fuzzing. * Fix CFLAGS/CXXFLAGS issue when building Git fuzzers. * Build corpora from packfiles and add libfuzzer options.
Diffstat (limited to 'projects')
-rw-r--r--projects/git/Dockerfile27
-rwxr-xr-xprojects/git/build.sh42
-rw-r--r--projects/git/project.yaml3
3 files changed, 72 insertions, 0 deletions
diff --git a/projects/git/Dockerfile b/projects/git/Dockerfile
new file mode 100644
index 00000000..a9fa16ce
--- /dev/null
+++ b/projects/git/Dockerfile
@@ -0,0 +1,27 @@
+# Copyright 2018 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 steadmon@google.com
+RUN apt-get update && \
+ apt-get install -y cvs cvsps gettext libcgi-pm-perl libcurl4-gnutls-dev \
+ libdbd-sqlite3-perl liberror-perl libexpat1-dev libhttp-date-perl \
+ libio-pty-perl libmailtools-perl libpcre2-dev libpcre3-dev libsvn-perl \
+ libtime-modules-perl libyaml-perl libz-dev python subversion tcl unzip \
+ asciidoc docbook-xsl xmlto libssl-dev zip
+RUN git clone --depth 1 https://github.com/git/git git
+WORKDIR git
+COPY build.sh $SRC/
diff --git a/projects/git/build.sh b/projects/git/build.sh
new file mode 100755
index 00000000..7e9b3d08
--- /dev/null
+++ b/projects/git/build.sh
@@ -0,0 +1,42 @@
+#!/bin/bash -eu
+# Copyright 2018 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.
+#
+################################################################################
+
+# build fuzzers
+make -j$(nproc) CC=$CC CXX=$CXX CFLAGS="$CXXFLAGS" \
+ LIB_FUZZING_ENGINE=$LIB_FUZZING_ENGINE fuzz-all
+
+FUZZERS="fuzz-pack-headers fuzz-pack-idx"
+
+# copy fuzzers
+for fuzzer in $FUZZERS ; do
+ cp $fuzzer $OUT
+done
+
+# build corpora from Git's own packfiles
+zip -j $OUT/fuzz-pack-idx_seed_corpus.zip .git/objects/pack/*.idx
+for packfile in .git/objects/pack/*.pack ; do
+ dd ibs=1 skip=12 if=$packfile of=$packfile.trimmed
+done
+zip -j $OUT/fuzz-pack-headers_seed_corpus.zip .git/objects/pack/*.pack.trimmed
+
+# Mute stderr
+for fuzzer in $FUZZERS ; do
+ cat >$OUT/$fuzzer.options << EOF
+[libfuzzer]
+close_fd_mask = 2
+EOF
+done
diff --git a/projects/git/project.yaml b/projects/git/project.yaml
new file mode 100644
index 00000000..d21585f9
--- /dev/null
+++ b/projects/git/project.yaml
@@ -0,0 +1,3 @@
+homepage: "https://git-scm.com"
+primary_contact: "steadmon@google.com"
+experimental: True