diff options
author | Mike Aizatsky <mike.aizatsky@gmail.com> | 2016-11-29 10:55:25 -0800 |
---|---|---|
committer | Mike Aizatsky <mike.aizatsky@gmail.com> | 2016-11-29 10:55:25 -0800 |
commit | a143b9b39a51412d133f846688194d68fe4197ba (patch) | |
tree | 936eb7e6c320fb7066f0da416727ebab8ce4668c /projects/expat | |
parent | 330c900781b1a8abde12e5478bb85854da48afc2 (diff) |
[infra] renaming targets/ to projects/
Diffstat (limited to 'projects/expat')
-rw-r--r-- | projects/expat/Dockerfile | 23 | ||||
-rw-r--r-- | projects/expat/Jenkinsfile | 23 | ||||
-rwxr-xr-x | projects/expat/build.sh | 27 | ||||
-rw-r--r-- | projects/expat/parse_fuzzer.cc | 23 | ||||
-rw-r--r-- | projects/expat/parse_fuzzer.options | 3 | ||||
-rw-r--r-- | projects/expat/target.yaml | 4 | ||||
-rw-r--r-- | projects/expat/xml.dict | 125 |
7 files changed, 228 insertions, 0 deletions
diff --git a/projects/expat/Dockerfile b/projects/expat/Dockerfile new file mode 100644 index 00000000..83302cd7 --- /dev/null +++ b/projects/expat/Dockerfile @@ -0,0 +1,23 @@ +# 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 ossfuzz/base-libfuzzer +MAINTAINER mike.aizatsky@gmail.com +RUN apt-get install -y make autoconf automake libtool docbook2x + +RUN git clone git://git.code.sf.net/p/expat/code_git expat +WORKDIR expat/expat +COPY build.sh parse_fuzzer.* xml.dict $SRC/ diff --git a/projects/expat/Jenkinsfile b/projects/expat/Jenkinsfile new file mode 100644 index 00000000..8dde3da7 --- /dev/null +++ b/projects/expat/Jenkinsfile @@ -0,0 +1,23 @@ +// 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. +// +//////////////////////////////////////////////////////////////////////////////// + +def libfuzzerBuild = fileLoader.fromGit('infra/libfuzzer-pipeline.groovy', + 'https://github.com/google/oss-fuzz.git') + +libfuzzerBuild { + git = "git://git.code.sf.net/p/expat/code_git" + sanitizers = ["address", "undefined"] +} diff --git a/projects/expat/build.sh b/projects/expat/build.sh new file mode 100755 index 00000000..06e03612 --- /dev/null +++ b/projects/expat/build.sh @@ -0,0 +1,27 @@ +#!/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. +# +################################################################################ + +./buildconf.sh +./configure +make clean +make -j$(nproc) all + +$CXX $CXXFLAGS -std=c++11 -Ilib/ \ + $SRC/parse_fuzzer.cc -o $OUT/parse_fuzzer \ + -lfuzzer .libs/libexpat.a + +cp $SRC/*.dict $SRC/*.options $OUT/ diff --git a/projects/expat/parse_fuzzer.cc b/projects/expat/parse_fuzzer.cc new file mode 100644 index 00000000..da464095 --- /dev/null +++ b/projects/expat/parse_fuzzer.cc @@ -0,0 +1,23 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <vector> +#include "expat.h" + +std::vector<const char*> kEncodings = {{"UTF-16", "UTF-8", "ISO-8859-1", + "US-ASCII", "UTF-16BE", "UTF-16LE", + "INVALIDENCODING"}}; +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + const char* dataPtr = reinterpret_cast<const char*>(data); + for (int use_ns = 0; use_ns <= 1; ++use_ns) { + for (auto enc : kEncodings) { + XML_Parser parser = + use_ns ? XML_ParserCreateNS(enc, '\n') : XML_ParserCreate(enc); + XML_Parse(parser, dataPtr, size, true); + XML_ParserFree(parser); + } + } + return 0; +} diff --git a/projects/expat/parse_fuzzer.options b/projects/expat/parse_fuzzer.options new file mode 100644 index 00000000..46f3f567 --- /dev/null +++ b/projects/expat/parse_fuzzer.options @@ -0,0 +1,3 @@ +[libfuzzer] +dict = xml.dict +max_len = 1024 diff --git a/projects/expat/target.yaml b/projects/expat/target.yaml new file mode 100644 index 00000000..b183ac20 --- /dev/null +++ b/projects/expat/target.yaml @@ -0,0 +1,4 @@ +homepage: "http://expat.sourceforge.net/" +sanitizers: + - address + - undefined diff --git a/projects/expat/xml.dict b/projects/expat/xml.dict new file mode 100644 index 00000000..8449cb08 --- /dev/null +++ b/projects/expat/xml.dict @@ -0,0 +1,125 @@ +# +# AFL dictionary for XML +# ---------------------- +# +# Several basic syntax elements and attributes, modeled on libxml2. +# +# Created by Michal Zalewski <lcamtuf@google.com> +# + +attr_encoding=" encoding=\"1\"" +attr_generic=" a=\"1\"" +attr_href=" href=\"1\"" +attr_standalone=" standalone=\"no\"" +attr_version=" version=\"1\"" +attr_xml_base=" xml:base=\"1\"" +attr_xml_id=" xml:id=\"1\"" +attr_xml_lang=" xml:lang=\"1\"" +attr_xml_space=" xml:space=\"1\"" +attr_xmlns=" xmlns=\"1\"" + +entity_builtin="<" +entity_decimal="" +entity_external="&a;" +entity_hex="" + +# keywords +"ANY" +"ATTLIST" +"CDATA" +"DOCTYPE" +"ELEMENT" +"EMPTY" +"ENTITIES" +"ENTITY" +"FIXED" +"ID" +"IDREF" +"IDREFS" +"IGNORE" +"IMPLIED" +"INCLUDE" +"NDATA" +"NMTOKEN" +"NMTOKENS" +"NOTATION" +"PCDATA" +"PUBLIC" +"REQUIRED" +"SYSTEM" + +# Various tag parts +"<" +">" +"/>" +"</" +"<?" +"?>" +"<!" +"!>" +"[]" +"]]" +"<![CDATA[" +"<![CDATA[]]>" +"\"\"" +"''" +"=\"\"" +"=''" + +# DTD +"<!ATTLIST" +"<!DOCTYPE" +"<!ELEMENT" +"<!ENTITY" +"<![IGNORE[" +"<![INCLUDE[" +"<!NOTATION" +"#CDATA" +"#FIXED" +"#IMPLIED" +"#PCDATA" +"#REQUIRED" + +# Encodings +"ISO-8859-1" +"US-ASCII" +"UTF-8" +"UTF-16" +"UTF-16BE" +"UTF-16LE" + +# Namespaces and schemas +"xmlns" +"xmlns:" +"xmlns:xhtml=\"http://www.w3.org/1999/xhtml\"" +"xmlns:xml=\"http://www.w3.org/XML/1998/namespace\"" +"xmlns:xmlns=\"http://www.w3.org/2000/xmlns\"" + +string_col_fallback=":fallback" +string_col_generic=":a" +string_col_include=":include" +string_dashes="--" +string_parentheses="()" +string_percent="%a" +string_schema=":schema" +string_ucs4="UCS-4" +tag_close="</a>" +tag_open="<a>" +tag_open_close="<a />" + + +"<?xml?>" +"http://docboo" +"http://www.w" +"he30" +"he2" +"IET" +"FDF-10" +"aDUCS-4OPveb:" +"a>" +"UT" +"xMl" +"/usr/share/sg" +"ha07" +"http://www.oa" +"cle" |