aboutsummaryrefslogtreecommitdiff
path: root/projects/uriparser
diff options
context:
space:
mode:
authorGoogle AutoFuzz Team <security-tps@google.com>2020-03-28 17:42:45 +0100
committerGitHub <noreply@github.com>2020-03-28 09:42:45 -0700
commit25e9894f3f38b418e6ab3e26b3857f7666426b78 (patch)
tree744d76e9144dc5c3634bb6991a077ed6f7c4a739 /projects/uriparser
parentcd848bbd392f23f16d4b19dda1884094d0bd664f (diff)
downloadoss-fuzz-25e9894f3f38b418e6ab3e26b3857f7666426b78.tar.gz
[uriparser] Add uriparser as a start (#3524)
* add uriparser * modified dockerfile and build.sh * change email address * Remove memory experimental flag (discouraged now) Co-authored-by: Abhishek Arya <inferno@chromium.org>
Diffstat (limited to 'projects/uriparser')
-rw-r--r--projects/uriparser/Dockerfile22
-rwxr-xr-xprojects/uriparser/build.sh31
-rw-r--r--projects/uriparser/project.yaml10
-rw-r--r--projects/uriparser/uri_free_fuzzer.cc29
4 files changed, 92 insertions, 0 deletions
diff --git a/projects/uriparser/Dockerfile b/projects/uriparser/Dockerfile
new file mode 100644
index 000000000..f66ca5342
--- /dev/null
+++ b/projects/uriparser/Dockerfile
@@ -0,0 +1,22 @@
+# Copyright 2020 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 webmaster@hartwork.org
+RUN apt-get update && apt-get install -y make autoconf automake wget sudo libtool cmake
+RUN git clone --depth 1 https://github.com/uriparser/uriparser uriparser
+WORKDIR uriparser
+COPY build.sh *.cc $SRC/
diff --git a/projects/uriparser/build.sh b/projects/uriparser/build.sh
new file mode 100755
index 000000000..3b7054de7
--- /dev/null
+++ b/projects/uriparser/build.sh
@@ -0,0 +1,31 @@
+#!/bin/bash -eu
+# Copyright 2020 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
+mkdir -p build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Release -DURIPARSER_BUILD_DOCS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF -DURIPARSER_BUILD_TESTS:BOOL=OFF ..
+make
+make install
+
+# build fuzzers
+for fuzzers in $(find $SRC -name '*_fuzzer.cc'); do
+ fuzz_basename=$(basename -s .cc $fuzzers)
+ $CXX $CXXFLAGS -std=c++11 -I. \
+ $fuzzers $LIB_FUZZING_ENGINE ./liburiparser.a \
+ -o $OUT/$fuzz_basename
+done
diff --git a/projects/uriparser/project.yaml b/projects/uriparser/project.yaml
new file mode 100644
index 000000000..b1eb5857e
--- /dev/null
+++ b/projects/uriparser/project.yaml
@@ -0,0 +1,10 @@
+homepage: "https://github.com/uriparser/uriparser"
+language: c++
+primary_contact: "webmaster@hartwork.org"
+sanitizers:
+ - address
+ - memory
+ - undefined
+architectures:
+ - x86_64
+ - i386
diff --git a/projects/uriparser/uri_free_fuzzer.cc b/projects/uriparser/uri_free_fuzzer.cc
new file mode 100644
index 000000000..1ed647a47
--- /dev/null
+++ b/projects/uriparser/uri_free_fuzzer.cc
@@ -0,0 +1,29 @@
+// Copyright 2020 Google LLC
+//
+// 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 <cstddef>
+#include <cstdint>
+#include <string>
+
+#include "uriparser/include/uriparser/Uri.h"
+
+extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
+ std::basic_string<char> fuzz_uri(reinterpret_cast<const char *>(data), size);
+ UriParserStateA state;
+ UriUriA uriA;
+ state.uri = &uriA;
+ uriParseUriA(&state, fuzz_uri.c_str());
+ uriFreeUriMembersA(&uriA);
+ return 0;
+}