aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/augeas
diff options
context:
space:
mode:
authorGravatar qiankehan <hanhanzhiyeqianke@gmail.com>2017-10-18 00:37:14 -0500
committerGravatar Kostya Serebryany <konstantin.s.serebryany@gmail.com>2017-10-17 22:37:14 -0700
commitd0d4a360e5c2de559ea96e14d9b2a0da26abdad3 (patch)
treef7ad223a6cc10b9ee26ac775a41f7713c95189bb /projects/augeas
parent76a30e08af6c664a53b5be559f38f0cbab48a29b (diff)
Integrate augeas project to oss-fuzz. (#893)
Diffstat (limited to 'projects/augeas')
-rw-r--r--projects/augeas/Dockerfile26
-rw-r--r--projects/augeas/augeas_escape_name_fuzzer.cc43
-rw-r--r--projects/augeas/build.sh28
-rw-r--r--projects/augeas/project.yaml8
4 files changed, 105 insertions, 0 deletions
diff --git a/projects/augeas/Dockerfile b/projects/augeas/Dockerfile
new file mode 100644
index 00000000..738a9c69
--- /dev/null
+++ b/projects/augeas/Dockerfile
@@ -0,0 +1,26 @@
+# Copyright 2016 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 hhan@redhat.com
+RUN apt-get update && apt-get install -y libreadline-dev libselinux1-dev \
+ libxml2-dev make autoconf automake libtool pkg-config bison flex
+
+RUN git clone --depth 1 https://github.com/hercules-team/augeas
+WORKDIR augeas
+
+COPY build.sh $SRC/
+COPY augeas_escape_name_fuzzer.cc $SRC/
diff --git a/projects/augeas/augeas_escape_name_fuzzer.cc b/projects/augeas/augeas_escape_name_fuzzer.cc
new file mode 100644
index 00000000..93bd2ca3
--- /dev/null
+++ b/projects/augeas/augeas_escape_name_fuzzer.cc
@@ -0,0 +1,43 @@
+/*
+# Copyright 2016 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.
+#
+################################################################################
+*/
+
+#include <string>
+
+#include <augeas.h>
+
+int escape_match(const uint8_t *data, size_t size){
+ augeas *aug = aug_init(NULL, NULL, AUG_NONE);
+ std::string data_string(reinterpret_cast<const char*>(data), size);
+ char *out;
+ aug_escape_name(aug, data_string.c_str(), &out);
+ if (out != NULL){
+ aug_match(aug, out, NULL);
+ }
+ else{
+ aug_match(aug, data_string.c_str(), NULL);
+ }
+ aug_close(aug);
+ delete[] out;
+ return 0;
+}
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t* Data, size_t Size) {
+ escape_match(Data, Size);
+ return 0;
+}
diff --git a/projects/augeas/build.sh b/projects/augeas/build.sh
new file mode 100644
index 00000000..a4cae739
--- /dev/null
+++ b/projects/augeas/build.sh
@@ -0,0 +1,28 @@
+#!/bin/bash -eu
+#
+# Copyright 2016 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.
+#
+################################################################################
+
+./autogen.sh
+./configure --enable-static --disable-shared --without-selinux
+make -j$(nproc)
+
+for fuzzer in augeas_escape_name_fuzzer; do
+ $CXX $CXXFLAGS -std=c++11 -Isrc/ `xml2-config --cflags` \
+ $SRC/$fuzzer.cc -o $OUT/$fuzzer -lFuzzingEngine \
+ src/.libs/libaugeas.a src/.libs/libfa.a ./gnulib/lib/.libs/libgnu.a \
+ /usr/lib/x86_64-linux-gnu/libxml2.a
+done
diff --git a/projects/augeas/project.yaml b/projects/augeas/project.yaml
new file mode 100644
index 00000000..a2dff42c
--- /dev/null
+++ b/projects/augeas/project.yaml
@@ -0,0 +1,8 @@
+homepage: https://github.com/hercules-team/augeas
+primary_contact: lutter@watzmann.net
+auto_ccs:
+ - hhan@redhat.com
+sanitizers:
+ - address
+ - memory
+ - undefined