aboutsummaryrefslogtreecommitdiff
path: root/projects/cmake
diff options
context:
space:
mode:
authorAdamKorcz <44787359+AdamKorcz@users.noreply.github.com>2021-01-25 19:46:30 +0000
committerGitHub <noreply@github.com>2021-01-25 11:46:30 -0800
commitb6b66e6228c265336350774e149e0aec6506f24b (patch)
tree66bee7e1a4236ee3cc28a9cec86d70fe2278e495 /projects/cmake
parent665e4898215c25a47dd29139f46c4f47f8139417 (diff)
downloadoss-fuzz-b6b66e6228c265336350774e149e0aec6506f24b.tar.gz
[cmake] Initial integration (#4917)
Co-authored-by: jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>
Diffstat (limited to 'projects/cmake')
-rw-r--r--projects/cmake/Dockerfile23
-rwxr-xr-xprojects/cmake/build.sh41
-rw-r--r--projects/cmake/project.yaml10
3 files changed, 74 insertions, 0 deletions
diff --git a/projects/cmake/Dockerfile b/projects/cmake/Dockerfile
new file mode 100644
index 000000000..2b7c2ef0f
--- /dev/null
+++ b/projects/cmake/Dockerfile
@@ -0,0 +1,23 @@
+# Copyright 2021 Google LLC
+#
+# 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
+RUN apt-get update && apt-get install -y make autoconf automake libtool \
+ pkg-config libssl-dev
+RUN git clone --depth 1 https://gitlab.kitware.com/cmake/cmake CMake
+RUN git clone --depth 1 https://github.com/strongcourage/fuzzing-corpus
+WORKDIR CMake
+COPY build.sh $SRC/
diff --git a/projects/cmake/build.sh b/projects/cmake/build.sh
new file mode 100755
index 000000000..01bb41b19
--- /dev/null
+++ b/projects/cmake/build.sh
@@ -0,0 +1,41 @@
+#!/bin/bash -eu
+# Copyright 2021 Google LLC
+#
+# 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 CMake.
+mkdir build-dir && cd build-dir
+../bootstrap && make -j$(nproc)
+
+
+# Build fuzzers.
+cd ../Tests/Fuzzing
+$CXX $CXXFLAGS -I../../Source \
+ -I../../build-dir/Source \
+ -c xml_parser_fuzzer.cc \
+ -o xml_parser_fuzzer.o
+
+
+export cmexpat_dir="${SRC}/CMake/build-dir/Utilities/cmexpat/CMakeFiles/cmexpat.dir/lib"
+$CXX $CXXFLAGS $LIB_FUZZING_ENGINE \
+ xml_parser_fuzzer.o -o $OUT/xml_parser_fuzzer \
+ ../../build-dir/Source/CMakeFiles/CMakeLib.dir/cmXMLParser.cxx.o \
+ $cmexpat_dir/xmlparse.c.o \
+ $cmexpat_dir/xmlrole.c.o \
+ $cmexpat_dir/xmltok.c.o
+
+
+# Build seed corpus
+zip $OUT/xml_parser_fuzzer_seed_corpus.zip $SRC/fuzzing-corpus/xml/test.xml
diff --git a/projects/cmake/project.yaml b/projects/cmake/project.yaml
new file mode 100644
index 000000000..8ab35334c
--- /dev/null
+++ b/projects/cmake/project.yaml
@@ -0,0 +1,10 @@
+homepage: "https://gitlab.kitware.com/cmake/cmake"
+main_repo: "https://gitlab.kitware.com/cmake/cmake"
+language: c
+primary_contact: "brad.king@kitware.com"
+auto_ccs:
+ - "Adam@adalogics.com"
+sanitizers:
+ - address
+ - undefined
+ - memory