diff options
author | aizatsky <aizatsky@chromium.org> | 2015-11-23 13:12:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-11-23 21:14:09 +0000 |
commit | 3cc4fe8d8ff01e7d9336df2bd6d3175c2bae6e32 (patch) | |
tree | 9ebeb6e41f5fb546932ca7a2eb7ef6814772f560 /testing | |
parent | 1de8a82b564ec43cdbe64817b95732eb449e8f11 (diff) | |
download | chromium_src-3cc4fe8d8ff01e7d9336df2bd6d3175c2bae6e32.zip chromium_src-3cc4fe8d8ff01e7d9336df2bd6d3175c2bae6e32.tar.gz chromium_src-3cc4fe8d8ff01e7d9336df2bd6d3175c2bae6e32.tar.bz2 |
//base:json reader fuzzer
BUG=
Review URL: https://codereview.chromium.org/1465283002
Cr-Commit-Position: refs/heads/master@{#361184}
Diffstat (limited to 'testing')
-rw-r--r-- | testing/libfuzzer/fuzzers/BUILD.gn | 10 | ||||
-rw-r--r-- | testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc | 17 |
2 files changed, 27 insertions, 0 deletions
diff --git a/testing/libfuzzer/fuzzers/BUILD.gn b/testing/libfuzzer/fuzzers/BUILD.gn index 49da60f..b64bc225 100644 --- a/testing/libfuzzer/fuzzers/BUILD.gn +++ b/testing/libfuzzer/fuzzers/BUILD.gn @@ -195,3 +195,13 @@ test("v8_json_parser_fuzzer") { "$root_out_dir/snapshot_blob.bin", ] } + +test("base_json_reader_fuzzer") { + sources = [ + "base_json_reader_fuzzer.cc", + ] + deps = [ + "//base", + "//testing/libfuzzer:libfuzzer_main", + ] +} diff --git a/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc b/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc new file mode 100644 index 0000000..d275654 --- /dev/null +++ b/testing/libfuzzer/fuzzers/base_json_reader_fuzzer.cc @@ -0,0 +1,17 @@ +// 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 <string> + +#include "base/json/json_reader.h" +#include "base/values.h" + +// Entry point for LibFuzzer. +extern "C" int LLVMFuzzerTestOneInput(const unsigned char* data, + unsigned long size) { + base::JSONReader reader; + reader.Read(std::string(reinterpret_cast<const char*>(data), size)); + return 0; +} + |