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/c-ares | |
parent | 330c900781b1a8abde12e5478bb85854da48afc2 (diff) | |
download | oss-fuzz-a143b9b39a51412d133f846688194d68fe4197ba.tar.gz |
[infra] renaming targets/ to projects/
Diffstat (limited to 'projects/c-ares')
-rw-r--r-- | projects/c-ares/Dockerfile | 22 | ||||
-rwxr-xr-x | projects/c-ares/build.sh | 28 | ||||
-rw-r--r-- | projects/c-ares/c_ares_ares_create_query_fuzzer.cc | 31 | ||||
-rw-r--r-- | projects/c-ares/target.yaml | 1 |
4 files changed, 82 insertions, 0 deletions
diff --git a/projects/c-ares/Dockerfile b/projects/c-ares/Dockerfile new file mode 100644 index 000000000..56e50dcf8 --- /dev/null +++ b/projects/c-ares/Dockerfile @@ -0,0 +1,22 @@ +# 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 mmoroz@chromium.org +RUN apt-get install -y make autoconf automake libtool +RUN git clone https://github.com/c-ares/c-ares.git +WORKDIR c-ares +COPY build.sh *_fuzzer.cc $SRC/ diff --git a/projects/c-ares/build.sh b/projects/c-ares/build.sh new file mode 100755 index 000000000..41fbf3bb6 --- /dev/null +++ b/projects/c-ares/build.sh @@ -0,0 +1,28 @@ +#!/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. +# +################################################################################ + +# Build the target. +./buildconf +./configure --enable-debug +make clean +make -j$(nproc) V=1 all + +# Build the fuzzer. +$CXX $CXXFLAGS -std=c++11 -I. \ + $SRC/c_ares_ares_create_query_fuzzer.cc \ + -o $OUT/c_ares_ares_create_query_fuzzer \ + -lfuzzer $SRC/c-ares/.libs/libcares.a diff --git a/projects/c-ares/c_ares_ares_create_query_fuzzer.cc b/projects/c-ares/c_ares_ares_create_query_fuzzer.cc new file mode 100644 index 000000000..fc12938e2 --- /dev/null +++ b/projects/c-ares/c_ares_ares_create_query_fuzzer.cc @@ -0,0 +1,31 @@ +// 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. + +#include <stdint.h> +#include <stdlib.h> + +#include <arpa/nameser.h> + +#include <string> + +#include <ares.h> + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { + unsigned char *buf; + int buflen; + std::string s(reinterpret_cast<const char *>(data), size); + ares_create_query(s.c_str(), ns_c_in, ns_t_a, 0x1234, 0, &buf, &buflen, 0); + ares_free_string(buf); + return 0; +} diff --git a/projects/c-ares/target.yaml b/projects/c-ares/target.yaml new file mode 100644 index 000000000..587904084 --- /dev/null +++ b/projects/c-ares/target.yaml @@ -0,0 +1 @@ +homepage: "https://c-ares.haxx.se/" |