Commit 0a523b3f authored by Chris Palmer's avatar Chris Palmer Committed by Commit Bot

Add a trivial fuzzer for inspector_protocol's CBOR parser.

Bug: None
Change-Id: I92514a0a3be55c1ed746a49de0f484fd924cbe05
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1602741Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Reviewed-by: default avatarAlexei Filippov <alph@chromium.org>
Reviewed-by: default avatarJonathan Metzman <metzman@chromium.org>
Reviewed-by: default avatarJohannes Henkel <johannes@chromium.org>
Commit-Queue: Chris Palmer <palmer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#658803}
parent e977efde
// Copyright 2019 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 <stddef.h>
#include <stdint.h>
#include <memory>
#include <vector>
#include "third_party/inspector_protocol/encoding/encoding.h"
// Entry point for LibFuzzer.
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
using namespace inspector_protocol_encoding;
span<uint8_t> fuzz{data, size};
// We need to handle whatever the parser parses. So, we handle the parsed
// stuff with another CBOR encoder, just because it's conveniently available.
std::vector<uint8_t> encoded;
Status status;
std::unique_ptr<StreamingParserHandler> encoder =
cbor::NewCBOREncoder(&encoded, &status);
cbor::ParseCBOR(fuzz, encoder.get());
return 0;
}
......@@ -139,6 +139,17 @@ fuzzer_test("devtools_protocol_encoding_json_fuzzer") {
seed_corpus = "//third_party/grpc/src/test/core/json/corpus/"
}
fuzzer_test("inspector_fuzzer") {
sources = [
"../../browser/devtools/inspector_fuzzer.cc",
]
deps = [
"//third_party/inspector_protocol:encoding",
]
seed_corpus = "//components/cbor/reader_fuzzer_corpus/"
libfuzzer_options = [ "max_len=65535" ]
}
fuzzer_test("http_structured_header_fuzzer") {
sources = [
"http_structured_header_fuzzer.cc",
......
......@@ -5,7 +5,7 @@ Version: 0
Revision: 2039736177ee11d96a096cdab9c58cc1d78faa43
License: BSD
License File: LICENSE
Security Critical: no
Security Critical: yes
Description:
WebKit/core/inspector uses these scripts to generate handlers from protocol
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment