summaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authoraizatsky <aizatsky@chromium.org>2015-10-16 14:14:15 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-16 21:15:27 +0000
commitc0d8ae4e8c37516c6f28661d17efe0e43a6aa2e9 (patch)
treea85625fe2dd86d3bc0bf275dd1d94b8863244f61 /testing
parent4581ce76cb87f3155e34885a77dc015a74c0ad2f (diff)
downloadchromium_src-c0d8ae4e8c37516c6f28661d17efe0e43a6aa2e9.zip
chromium_src-c0d8ae4e8c37516c6f28661d17efe0e43a6aa2e9.tar.gz
chromium_src-c0d8ae4e8c37516c6f28661d17efe0e43a6aa2e9.tar.bz2
Example libfuzzer GURL test & remaining plumbing.
BUG=539572 TBR=dpranke@chromium.org Review URL: https://codereview.chromium.org/1398353003 Cr-Commit-Position: refs/heads/master@{#354596}
Diffstat (limited to 'testing')
-rw-r--r--testing/libfuzzer/BUILD.gn14
-rw-r--r--testing/libfuzzer/url_parse_fuzzer.cc12
2 files changed, 26 insertions, 0 deletions
diff --git a/testing/libfuzzer/BUILD.gn b/testing/libfuzzer/BUILD.gn
index f9dc5b5..17805f3 100644
--- a/testing/libfuzzer/BUILD.gn
+++ b/testing/libfuzzer/BUILD.gn
@@ -1,3 +1,7 @@
+# Copyright 2015 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.
+
# LibFuzzer is a LLVM tool for coverage-guided fuzz testing.
# See http://www.chromium.org/developers/testing/libfuzzer
#
@@ -28,3 +32,13 @@ static_library("libfuzzer_main") {
"//buildtools/third_party/libc++abi/trunk/include",
]
}
+
+test("url_parse_fuzzer") {
+ sources = [
+ "url_parse_fuzzer.cc",
+ ]
+ deps = [
+ ":libfuzzer_main",
+ "//url:url",
+ ]
+}
diff --git a/testing/libfuzzer/url_parse_fuzzer.cc b/testing/libfuzzer/url_parse_fuzzer.cc
new file mode 100644
index 0000000..48df2c8
--- /dev/null
+++ b/testing/libfuzzer/url_parse_fuzzer.cc
@@ -0,0 +1,12 @@
+// Copyright (c) 2015 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 "url/gurl.h"
+
+// Entry point for LibFuzzer.
+extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data,
+ unsigned long size) {
+ GURL url(std::string(reinterpret_cast<const char*>(data), size));
+ return 0;
+}