aboutsummaryrefslogtreecommitdiff
path: root/projects/cmark
diff options
context:
space:
mode:
authorPhil Turnbull <philipturnbull@github.com>2017-06-28 10:47:14 -0400
committerAbhishek Arya <inferno@chromium.org>2017-06-28 07:47:14 -0700
commit0e1d44aeee64e8021181c146d831eac980b594b8 (patch)
tree0180496bd99bde90d9211f937d1f5e55a182cfdf /projects/cmark
parente17dcc7a73183f2b9ecf3fe5b8ee1e792daff3c5 (diff)
downloadoss-fuzz-0e1d44aeee64e8021181c146d831eac980b594b8.tar.gz
New project: CommonMark (#694)
* [cmark] Add cmark_markdown_to_html fuzzer * [cmark] Use correct filename for seed corpus * [cmark] Use upstream fuzz harness * [cmark] Do not use $WORK for temporary files * [cmark] Generate seed corpus from michelf/mdtest repo * [cmark] Add @kivikakk as an auto CC
Diffstat (limited to 'projects/cmark')
-rw-r--r--projects/cmark/Dockerfile22
-rwxr-xr-xprojects/cmark/build.sh38
-rw-r--r--projects/cmark/cmark_fuzzer.options3
-rw-r--r--projects/cmark/project.yaml8
4 files changed, 71 insertions, 0 deletions
diff --git a/projects/cmark/Dockerfile b/projects/cmark/Dockerfile
new file mode 100644
index 000000000..150bab8d4
--- /dev/null
+++ b/projects/cmark/Dockerfile
@@ -0,0 +1,22 @@
+# Copyright 2017 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 philipturnbull@github.com
+RUN apt-get update && apt-get install -y make cmake
+RUN git clone --depth 1 https://github.com/jgm/cmark.git cmark
+WORKDIR cmark
+COPY build.sh *.dict *.options $SRC/
diff --git a/projects/cmark/build.sh b/projects/cmark/build.sh
new file mode 100755
index 000000000..ae416a0ed
--- /dev/null
+++ b/projects/cmark/build.sh
@@ -0,0 +1,38 @@
+#!/bin/bash -eu
+# Copyright 2017 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.
+#
+################################################################################
+
+make -j$(nproc) cmake_build
+
+$CC $CFLAGS -Isrc -Ibuild/src -c $SRC/cmark/test/cmark-fuzz.c -o cmark_fuzzer.o
+$CXX $CXXFLAGS -lFuzzingEngine cmark_fuzzer.o build/src/libcmark.a -o $OUT/cmark_fuzzer
+
+cp $SRC/*.options $OUT/
+cp $SRC/cmark/test/fuzzing_dictionary $OUT/cmark.dict
+
+mkdir -p corpus
+cp $SRC/cmark/test/afl_test_cases/* corpus
+
+git clone --depth 1 https://github.com/michelf/mdtest.git mdtest
+find mdtest/*.mdtest -type f -name '*.text' | while read in_file
+do
+ # Genreate unique name for each input...
+ out_file=$(sha1sum "$in_file" | cut -c 1-32)
+ # ... and prepend a four-byte 'options' header
+ printf "\0\0\0\0" > "corpus/$out_file"
+ cat "$in_file" >> "corpus/$out_file"
+done
+zip -j $OUT/cmark_fuzzer_seed_corpus.zip corpus/*
diff --git a/projects/cmark/cmark_fuzzer.options b/projects/cmark/cmark_fuzzer.options
new file mode 100644
index 000000000..58e07559d
--- /dev/null
+++ b/projects/cmark/cmark_fuzzer.options
@@ -0,0 +1,3 @@
+[libfuzzer]
+dict = cmark.dict
+max_len = 256
diff --git a/projects/cmark/project.yaml b/projects/cmark/project.yaml
new file mode 100644
index 000000000..ddaf0c804
--- /dev/null
+++ b/projects/cmark/project.yaml
@@ -0,0 +1,8 @@
+homepage: "http://commonmark.org"
+primary_contact: "jgm@berkeley.edu"
+auto_ccs:
+ - "kivikakk@github.com"
+sanitizers:
+ - address
+ - memory
+ - undefined