Add hoextdown (#1430)

This commit is contained in:
kjdev 2018-06-01 08:25:25 +09:00 committed by Kostya Serebryany
parent 8b206083f7
commit 183d5ffe3d
5 changed files with 115 additions and 0 deletions

22
hoextdown/Dockerfile Normal file
View File

@ -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/

40
hoextdown/build.sh Executable file
View File

@ -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/*

49
hoextdown/hoextdown.dict Normal file
View File

@ -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="<![CDATA["
tag_close="</a>"
tag_doctype="<!DOCTYPE"
tag_element="<!ELEMENT"
tag_entity="<!ENTITY"
tag_notation="<!NOTATION"
tag_open="<a>"
tag_open_close="<a />"
tag_open_exclamation="<!"
tag_open_q="<?"
tag_sq2_close="]]>"
tag_xml_q="<?xml?>"
underscore="_"

View File

@ -0,0 +1,2 @@
[libfuzzer]
dict = hoextdown.dict

2
hoextdown/project.yaml Normal file
View File

@ -0,0 +1,2 @@
homepage: "https://github.com/kjdev/hoextdown"
primary_contact: "kjclev@gmail.com"