Commit 95ab6b66 authored by cfredric's avatar cfredric Committed by Commit Bot

Ensure ICU initialization via net_fuzzer_test_support.

The first time I was notified about ICU not being initialized, it was
for the first_party_sets_parser_json_fuzzer target, which makes sense
because that target did not depend on net_fuzzer_test_support, so ICU
didn't get initialized for it. But when I added the manual
initialization to both fuzzers, now the first_party_set_parser_fuzzer
had ICU initialized twice. This could also be fixed by calling
AllowMultipleInitializeCallsForTesting, but it's neater to just remove
the manual initializations for both fuzzers and add the dependency to
the JSON fuzzer.

Bug: 1146783
Change-Id: I4f3c81ca0cf662010db3e159e226b13e09a55b8b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2526907
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: default avatarEric Orth <ericorth@chromium.org>
Reviewed-by: default avatarDan McArdle <dmcardle@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825496}
parent a3c624d8
...@@ -87,7 +87,6 @@ fuzzer_test("first_party_set_parser_fuzzer") { ...@@ -87,7 +87,6 @@ fuzzer_test("first_party_set_parser_fuzzer") {
deps = [ deps = [
":first_party_sets", ":first_party_sets",
"//base", "//base",
"//base:i18n",
"//net:net", "//net:net",
"//net:net_fuzzer_test_support", "//net:net_fuzzer_test_support",
] ]
...@@ -100,8 +99,8 @@ fuzzer_test("first_party_set_parser_json_fuzzer") { ...@@ -100,8 +99,8 @@ fuzzer_test("first_party_set_parser_json_fuzzer") {
deps = [ deps = [
":first_party_sets", ":first_party_sets",
"//base", "//base",
"//base:i18n",
"//net:net", "//net:net",
"//net:net_fuzzer_test_support",
"//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,19 +7,8 @@ ...@@ -7,19 +7,8 @@
#include <cstdint> #include <cstdint>
#include <memory> #include <memory>
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "net/base/schemeful_site.h" #include "net/base/schemeful_site.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,22 +7,11 @@ ...@@ -7,22 +7,11 @@
#include <stdlib.h> #include <stdlib.h>
#include <iostream> #include <iostream>
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "net/base/schemeful_site.h" #include "net/base/schemeful_site.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