From 183d5ffe3d32650ea3b57c58dd6c225625107086 Mon Sep 17 00:00:00 2001 From: kjdev Date: Fri, 1 Jun 2018 08:25:25 +0900 Subject: [PATCH] Add hoextdown (#1430) --- hoextdown/Dockerfile | 22 ++++++++++++++ hoextdown/build.sh | 40 ++++++++++++++++++++++++ hoextdown/hoextdown.dict | 49 ++++++++++++++++++++++++++++++ hoextdown/hoextdown_fuzzer.options | 2 ++ hoextdown/project.yaml | 2 ++ 5 files changed, 115 insertions(+) create mode 100644 hoextdown/Dockerfile create mode 100755 hoextdown/build.sh create mode 100644 hoextdown/hoextdown.dict create mode 100644 hoextdown/hoextdown_fuzzer.options create mode 100644 hoextdown/project.yaml diff --git a/hoextdown/Dockerfile b/hoextdown/Dockerfile new file mode 100644 index 000000000..d4f7d1d06 --- /dev/null +++ b/hoextdown/Dockerfile @@ -0,0 +1,22 @@ +# 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 kjclev@gmail.com +RUN apt-get update && apt-get install -y make autoconf automake libtool +RUN git clone --depth 1 https://github.com/kjdev/hoextdown.git hoextdown +WORKDIR hoextdown +COPY build.sh *.options *.dict $SRC/ diff --git a/hoextdown/build.sh b/hoextdown/build.sh new file mode 100755 index 000000000..633558b1e --- /dev/null +++ b/hoextdown/build.sh @@ -0,0 +1,40 @@ +#!/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 project +make -j$(nproc) all + +# build fuzzers +$CC $CFLAGS -c -std=c99 -Isrc \ + "$SRC/hoextdown/test/hoedown_fuzzer.c" -o $WORK/hoedown_fuzzer.o +$CXX $CXXFLAGS -std=c++11 -Isrc \ + $WORK/hoedown_fuzzer.o -o $OUT/hoedown_fuzzer \ + -lFuzzingEngine "$SRC/hoextdown/libhoedown.a" + +cp $SRC/*.options $OUT/ +cp $SRC/*.dict $OUT/ + +# build corpus +mkdir -p corpus +find $SRC/hoextdown/test -type f -name '*.text' | while read in_file +do + # Genreate unique name for each input... + out_file=$(sha1sum "$in_file" | cut -c 1-32) + cat "$in_file" >> "corpus/$out_file" +done + +zip -j $OUT/hoextdown_fuzzer_corpus.zip corpus/* diff --git a/hoextdown/hoextdown.dict b/hoextdown/hoextdown.dict new file mode 100644 index 000000000..b06783c94 --- /dev/null +++ b/hoextdown/hoextdown.dict @@ -0,0 +1,49 @@ +asterisk="*" +attr_generic=" a=\"1\"" +attr_href=" href=\"1\"" +attr_xml_lang=" xml:lang=\"1\"" +attr_xmlns=" xmlns=\"1\"" +backslash="\\" +backtick="`" +colon=":" +dashes="---" +double_quote="\"" +entity_builtin="<" +entity_decimal="" +entity_external="&a;" +entity_hex="" +equals="===" +exclamation="!" +greater_than=">" +hash="#" +hyphen="-" +indent=" " +left_bracket="[" +left_paren="(" +less_than="<" +plus="+" +right_bracket="]" +right_paren=")" +single_quote="'" +string_any="ANY" +string_brackets="[]" +string_cdata="CDATA" +string_dashes="--" +string_empty_dblquotes="\"\"" +string_empty_quotes="''" +string_idrefs="IDREFS" +string_parentheses="()" +string_pcdata="#PCDATA" +tag_cdata="" +tag_doctype="" +tag_open_close="" +tag_open_exclamation="" +tag_xml_q="" +underscore="_" diff --git a/hoextdown/hoextdown_fuzzer.options b/hoextdown/hoextdown_fuzzer.options new file mode 100644 index 000000000..780b7d70a --- /dev/null +++ b/hoextdown/hoextdown_fuzzer.options @@ -0,0 +1,2 @@ +[libfuzzer] +dict = hoextdown.dict diff --git a/hoextdown/project.yaml b/hoextdown/project.yaml new file mode 100644 index 000000000..ed77533e5 --- /dev/null +++ b/hoextdown/project.yaml @@ -0,0 +1,2 @@ +homepage: "https://github.com/kjdev/hoextdown" +primary_contact: "kjclev@gmail.com"