aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tsdgeos <aacid@kde.org>2019-04-09 20:23:05 +0200
committerGravatar Abhishek Arya <inferno@chromium.org>2019-04-09 11:23:05 -0700
commite445a90d9445440d6672c8b0ab3f148bf63bc675 (patch)
treef702550e1b52599a4e4390370871cd7ef08a4af7
parent676071636c990b3f2801b359a20c587d1bcb5aa8 (diff)
Add libical (#2298)
-rw-r--r--projects/libical/Dockerfile26
-rw-r--r--projects/libical/build.sh6
-rw-r--r--projects/libical/libical_fuzzer.cc44
-rw-r--r--projects/libical/project.yaml8
4 files changed, 84 insertions, 0 deletions
diff --git a/projects/libical/Dockerfile b/projects/libical/Dockerfile
new file mode 100644
index 00000000..a95e778a
--- /dev/null
+++ b/projects/libical/Dockerfile
@@ -0,0 +1,26 @@
+# 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 tsdgeos@gmail.com
+RUN apt-get install --yes cmake
+RUN git clone --depth 1 https://github.com/libical/libical.git
+COPY build.sh $SRC
+COPY libical_fuzzer.cc $SRC
+WORKDIR libical
+
+
+
diff --git a/projects/libical/build.sh b/projects/libical/build.sh
new file mode 100644
index 00000000..eb0587f9
--- /dev/null
+++ b/projects/libical/build.sh
@@ -0,0 +1,6 @@
+cmake . -DBUILD_SHARED_LIBS=OFF -DICAL_GLIB=False
+make install -j$(nproc)
+
+$CXX $CXXFLAGS -std=c++11 $SRC/libical_fuzzer.cc -lFuzzingEngine /usr/local/lib/libical.a -o $OUT/libical_fuzzer
+
+find . -name *.ics -print | zip -q $OUT/libical_fuzzer_seed_corpus.zip -@
diff --git a/projects/libical/libical_fuzzer.cc b/projects/libical/libical_fuzzer.cc
new file mode 100644
index 00000000..23f1b766
--- /dev/null
+++ b/projects/libical/libical_fuzzer.cc
@@ -0,0 +1,44 @@
+/*
+# 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.
+#
+################################################################################
+*/
+
+/*
+ Usage:
+ python infra/helper.py build_image libical
+ python infra/helper.py build_fuzzers --sanitizer undefined|address|memory libical
+ python infra/helper.py run_fuzzer libical libical_fuzzer
+*/
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <libical/ical.h>
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
+{
+ char *ical_string = (char*)malloc(size + 1);
+ memcpy(ical_string, data, size);
+ ical_string[size] = '\0';
+
+ icalcomponent *component = icalparser_parse_string(ical_string);
+ icalcomponent_free(component);
+
+ free(ical_string);
+
+ return 0;
+}
diff --git a/projects/libical/project.yaml b/projects/libical/project.yaml
new file mode 100644
index 00000000..0e050099
--- /dev/null
+++ b/projects/libical/project.yaml
@@ -0,0 +1,8 @@
+homepage: https://github.com/libical/libical
+primary_contact: tsdgeos@gmail.com
+auto_ccs:
+ - allen.d.winter@gmail.com
+sanitizers:
+ - address
+ - memory
+ - undefined