Commit 5d797a81 authored by Tim Judkins's avatar Tim Judkins Committed by Commit Bot

[Extensions] Add fuzzer for Extension::ParsePEMKeyBytes()

Bug: NONE
Change-Id: I30b44520dbd7e69b7ed076afbed964f50e77455a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1867123
Commit-Queue: Tim Judkins <tjudkins@chromium.org>
Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#707489}
parent f8598558
......@@ -7,6 +7,7 @@ import("//build/config/jumbo.gni")
import("//components/nacl/features.gni")
import("//extensions/buildflags/buildflags.gni")
import("//mojo/public/tools/bindings/mojom.gni")
import("//testing/libfuzzer/fuzzer_test.gni")
# TODO(crbug.com/731689): Assert that extensions are enabled.
......@@ -484,4 +485,14 @@ if (enable_extensions) {
"//tools/metrics/histograms/enums.xml",
]
}
fuzzer_test("extension_fuzzer") {
sources = [
"extension_fuzzer.cc",
]
deps = [
":common",
"//base",
]
}
} # enable_extensions
// 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 "extensions/common/extension.h"
namespace extensions {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
std::string key_contents(reinterpret_cast<const char*>(data), size);
std::string key_bytes;
Extension::ParsePEMKeyBytes(key_contents, &key_bytes);
return 0;
}
} // namespace extensions
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