Commit a3622174 authored by cfredric's avatar cfredric Committed by Commit Bot

Initialize ICU before fuzzing FirstPartySetParser.

Bug: 1146217
Change-Id: I59fda9bb717fad0fe19dc557461b1ca763f436a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2522895
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: default avatarDan McArdle <dmcardle@chromium.org>
Reviewed-by: default avatarEric Orth <ericorth@chromium.org>
Cr-Commit-Position: refs/heads/master@{#824963}
parent 1f13d955
...@@ -87,6 +87,7 @@ fuzzer_test("first_party_set_parser_fuzzer") { ...@@ -87,6 +87,7 @@ fuzzer_test("first_party_set_parser_fuzzer") {
deps = [ deps = [
":first_party_sets", ":first_party_sets",
"//base", "//base",
"//base:i18n",
"//net:net_fuzzer_test_support", "//net:net_fuzzer_test_support",
] ]
dict = "test/first_party_set_parser_fuzzer.dict" dict = "test/first_party_set_parser_fuzzer.dict"
...@@ -98,6 +99,7 @@ fuzzer_test("first_party_set_parser_json_fuzzer") { ...@@ -98,6 +99,7 @@ fuzzer_test("first_party_set_parser_json_fuzzer") {
deps = [ deps = [
":first_party_sets", ":first_party_sets",
"//base", "//base",
"//base:i18n",
"//testing/libfuzzer/proto:json_proto", "//testing/libfuzzer/proto:json_proto",
"//testing/libfuzzer/proto:json_proto_converter", "//testing/libfuzzer/proto:json_proto_converter",
"//third_party/libprotobuf-mutator", "//third_party/libprotobuf-mutator",
......
...@@ -7,6 +7,18 @@ ...@@ -7,6 +7,18 @@
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
struct TestCase {
TestCase() { CHECK(base::i18n::InitializeICU()); }
// used by ICU integration.
base::AtExitManager at_exit_manager;
};
TestCase* test_case = new TestCase();
namespace network { namespace network {
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
......
...@@ -7,10 +7,21 @@ ...@@ -7,10 +7,21 @@
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "testing/libfuzzer/proto/json.pb.h" #include "testing/libfuzzer/proto/json.pb.h"
#include "testing/libfuzzer/proto/json_proto_converter.h" #include "testing/libfuzzer/proto/json_proto_converter.h"
#include "testing/libfuzzer/proto/lpm_interface.h" #include "testing/libfuzzer/proto/lpm_interface.h"
struct TestCase {
TestCase() { CHECK(base::i18n::InitializeICU()); }
// used by ICU integration.
base::AtExitManager at_exit_manager;
};
TestCase* test_case = new TestCase();
DEFINE_PROTO_FUZZER(const json_proto::JsonValue& json_value) { DEFINE_PROTO_FUZZER(const json_proto::JsonValue& json_value) {
json_proto::JsonProtoConverter converter; json_proto::JsonProtoConverter converter;
std::string native_input = converter.Convert(json_value); std::string native_input = converter.Convert(json_value);
......
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