diff --git a/BUILD.gn b/BUILD.gn index a325e9fa58ae53..1c9bb954acc172 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -235,8 +235,6 @@ group("both_gn_and_gyp") { "//gpu/khronos_glcts_support:khronos_glcts_test", "//jingle:jingle_unittests", "//net:hpack_example_generator", - "//net:hpack_fuzz_mutator", - "//net:hpack_fuzz_wrapper", "//ppapi:ppapi_unittests", "//ppapi/examples/2d", "//ppapi/examples/audio", @@ -1044,7 +1042,6 @@ if (!is_ios && !is_android && !is_chromecast) { if (!is_win) { deps += [ "//net:dns_fuzz_stub", - "//net:hpack_fuzz_wrapper", "//skia:filter_fuzz_stub", ] } diff --git a/net/BUILD.gn b/net/BUILD.gn index 74953f2d4579a8..8c4009f16395a3 100644 --- a/net/BUILD.gn +++ b/net/BUILD.gn @@ -2699,38 +2699,6 @@ if (!is_ios && !is_android) { ] } - executable("hpack_fuzz_mutator") { - testonly = true - sources = [ - "spdy/fuzzing/hpack_fuzz_mutator.cc", - ] - - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] - deps = [ - ":net", - "//base", - "//build/config/sanitizers:deps", - "//build/win:default_exe_manifest", - ] - } - - executable("hpack_fuzz_wrapper") { - testonly = true - sources = [ - "spdy/fuzzing/hpack_fuzz_wrapper.cc", - ] - - # TODO(jschuh): crbug.com/167187 fix size_t to int truncations. - configs += [ "//build/config/compiler:no_size_t_to_int_warning" ] - deps = [ - ":net", - "//base", - "//build/config/sanitizers:deps", - "//build/win:default_exe_manifest", - ] - } - if (use_v8_in_net) { executable("net_watcher") { testonly = true diff --git a/net/spdy/fuzzing/hpack_fuzz_mutator.cc b/net/spdy/fuzzing/hpack_fuzz_mutator.cc deleted file mode 100644 index c0e76d25ffc4c4..00000000000000 --- a/net/spdy/fuzzing/hpack_fuzz_mutator.cc +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2014 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 "base/command_line.h" -#include "base/files/file.h" -#include "base/files/file_util.h" -#include "base/strings/string_number_conversions.h" -#include "net/spdy/fuzzing/hpack_fuzz_util.h" - -namespace { - -// Specifies a file having HPACK header sets. -const char kFileToParse[] = "file-to-parse"; - -// Target file for mutated HPACK header sets. -const char kFileToWrite[] = "file-to-write"; - -// Number of bits to flip per 1,024 bytes of input. -const char kFlipsPerThousand[] = "flips-per-thousand-bytes"; - -} // namespace - -using base::StringPiece; -using net::HpackFuzzUtil; -using std::string; - -// Reads length-prefixed input blocks, applies a bit-flipping mutation to each -// block, and writes length-prefixed blocks to the output file. While blocks -// themselves are mutated, the length-prefixes of written blocks are not. -int main(int argc, char** argv) { - base::CommandLine::Init(argc, argv); - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - - if (!command_line.HasSwitch(kFileToParse) || - !command_line.HasSwitch(kFileToWrite) || - !command_line.HasSwitch(kFlipsPerThousand)) { - LOG(ERROR) << "Usage: " << argv[0] - << " --" << kFileToParse << "=/path/to/file.in" - << " --" << kFileToWrite << "=/path/to/file.out" - << " --" << kFlipsPerThousand << "=10"; - return -1; - } - string file_to_parse = command_line.GetSwitchValueASCII(kFileToParse); - string file_to_write = command_line.GetSwitchValueASCII(kFileToWrite); - - int flip_ratio = 0; - CHECK(base::StringToInt(command_line.GetSwitchValueASCII(kFlipsPerThousand), - &flip_ratio)); - - DVLOG(1) << "Reading input from " << file_to_parse; - HpackFuzzUtil::Input input; - CHECK(base::ReadFileToString(base::FilePath::FromUTF8Unsafe(file_to_parse), - &input.input)); - - DVLOG(1) << "Writing output to " << file_to_write; - base::File file_out(base::FilePath::FromUTF8Unsafe(file_to_write), - base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); - CHECK(file_out.IsValid()) << file_out.error_details(); - - DVLOG(1) << "Flipping " << flip_ratio << " bits per 1024 input bytes"; - - size_t block_count = 0; - StringPiece block; - while (HpackFuzzUtil::NextHeaderBlock(&input, &block)) { - HpackFuzzUtil::FlipBits( - reinterpret_cast(const_cast(block.data())), - block.size(), flip_ratio); - - string prefix = HpackFuzzUtil::HeaderBlockPrefix(block.size()); - - CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size())); - CHECK_LT(0, file_out.WriteAtCurrentPos(block.data(), block.size())); - ++block_count; - } - CHECK(file_out.Flush()); - DVLOG(1) << "Mutated " << block_count << " blocks."; - return 0; -} diff --git a/net/spdy/fuzzing/hpack_fuzz_wrapper.cc b/net/spdy/fuzzing/hpack_fuzz_wrapper.cc deleted file mode 100644 index f816b1eff62152..00000000000000 --- a/net/spdy/fuzzing/hpack_fuzz_wrapper.cc +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 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 "base/at_exit.h" -#include "base/command_line.h" -#include "base/files/file_util.h" -#include "net/spdy/fuzzing/hpack_fuzz_util.h" - -namespace { - -// Specifies a file having HPACK header sets. -const char kFileToParse[] = "file-to-parse"; - -} // namespace - -using base::StringPiece; -using net::HpackFuzzUtil; -using std::string; - -// Sequentially runs each given length-prefixed header block through -// decoding and encoding fuzzing stages (using HpackFuzzUtil). -int main(int argc, char** argv) { - base::AtExitManager exit_manager; - - base::CommandLine::Init(argc, argv); - const base::CommandLine& command_line = - *base::CommandLine::ForCurrentProcess(); - - if (!command_line.HasSwitch(kFileToParse)) { - LOG(ERROR) << "Usage: " << argv[0] - << " --" << kFileToParse << "=/path/to/file.in"; - return -1; - } - string file_to_parse = command_line.GetSwitchValueASCII(kFileToParse); - - // ClusterFuzz may invoke as --file-to-parse="". Don't crash in this case. - if (file_to_parse.empty()) { - LOG(WARNING) << "Empty file to parse given. Doing nothing."; - return 0; - } - - DVLOG(1) << "Reading input from " << file_to_parse; - HpackFuzzUtil::Input input; - CHECK(base::ReadFileToString(base::FilePath::FromUTF8Unsafe(file_to_parse), - &input.input)); - - HpackFuzzUtil::FuzzerContext context; - HpackFuzzUtil::InitializeFuzzerContext(&context); - - size_t block_count = 0; - StringPiece block; - while (HpackFuzzUtil::NextHeaderBlock(&input, &block)) { - HpackFuzzUtil::RunHeaderBlockThroughFuzzerStages(&context, block); - ++block_count; - } - DVLOG(1) << "Fuzzed " << block_count << " blocks."; - return 0; -} diff --git a/net/spdy/hpack/hpack_header_table.cc b/net/spdy/hpack/hpack_header_table.cc index d6fc7d250a8bf4..274e872a716fa3 100644 --- a/net/spdy/hpack/hpack_header_table.cc +++ b/net/spdy/hpack/hpack_header_table.cc @@ -127,13 +127,7 @@ void HpackHeaderTable::SetMaxSize(size_t max_size) { void HpackHeaderTable::SetSettingsHeaderTableSize(size_t settings_size) { settings_size_bound_ = settings_size; - if (!FLAGS_chromium_reloadable_flag_increase_hpack_table_size) { - if (settings_size_bound_ < max_size_) { - SetMaxSize(settings_size_bound_); - } - } else { - SetMaxSize(settings_size_bound_); - } + SetMaxSize(settings_size_bound_); } void HpackHeaderTable::EvictionSet(StringPiece name, diff --git a/net/spdy/hpack/hpack_header_table_test.cc b/net/spdy/hpack/hpack_header_table_test.cc index 3a470365f042f1..410e82ffc3c2f6 100644 --- a/net/spdy/hpack/hpack_header_table_test.cc +++ b/net/spdy/hpack/hpack_header_table_test.cc @@ -259,7 +259,6 @@ TEST_F(HpackHeaderTableTest, EntryIndexing) { } TEST_F(HpackHeaderTableTest, SetSizes) { - FLAGS_chromium_reloadable_flag_increase_hpack_table_size = true; string key = "key", value = "value"; const HpackEntry* entry1 = table_.TryAddEntry(key, value); const HpackEntry* entry2 = table_.TryAddEntry(key, value); @@ -291,42 +290,6 @@ TEST_F(HpackHeaderTableTest, SetSizes) { EXPECT_EQ(0u, peer_.dynamic_entries().size()); } -TEST_F(HpackHeaderTableTest, SetSizesOld) { - FLAGS_chromium_reloadable_flag_increase_hpack_table_size = false; - - string key = "key", value = "value"; - const HpackEntry* entry1 = table_.TryAddEntry(key, value); - const HpackEntry* entry2 = table_.TryAddEntry(key, value); - const HpackEntry* entry3 = table_.TryAddEntry(key, value); - - // Set exactly large enough. No Evictions. - size_t max_size = entry1->Size() + entry2->Size() + entry3->Size(); - table_.SetMaxSize(max_size); - EXPECT_EQ(3u, peer_.dynamic_entries().size()); - - // Set just too small. One eviction. - max_size = entry1->Size() + entry2->Size() + entry3->Size() - 1; - table_.SetMaxSize(max_size); - EXPECT_EQ(2u, peer_.dynamic_entries().size()); - - // Changing SETTINGS_HEADER_TABLE_SIZE doesn't affect table_.max_size(), - // iff SETTINGS_HEADER_TABLE_SIZE >= |max_size|. - EXPECT_EQ(kDefaultHeaderTableSizeSetting, table_.settings_size_bound()); - table_.SetSettingsHeaderTableSize(kDefaultHeaderTableSizeSetting * 2); - EXPECT_EQ(max_size, table_.max_size()); - table_.SetSettingsHeaderTableSize(max_size + 1); - EXPECT_EQ(max_size, table_.max_size()); - EXPECT_EQ(2u, peer_.dynamic_entries().size()); - - // SETTINGS_HEADER_TABLE_SIZE upper-bounds |table_.max_size()|, - // and will force evictions. - max_size = entry3->Size() - 1; - table_.SetSettingsHeaderTableSize(max_size); - EXPECT_EQ(max_size, table_.max_size()); - EXPECT_EQ(max_size, table_.settings_size_bound()); - EXPECT_EQ(0u, peer_.dynamic_entries().size()); -} - TEST_F(HpackHeaderTableTest, EvictionCountForEntry) { string key = "key", value = "value"; const HpackEntry* entry1 = table_.TryAddEntry(key, value); diff --git a/net/spdy/spdy_flags.cc b/net/spdy/spdy_flags.cc index b8975205d68764..4ff63c5f9e1c91 100644 --- a/net/spdy/spdy_flags.cc +++ b/net/spdy/spdy_flags.cc @@ -18,10 +18,6 @@ bool FLAGS_chromium_http2_flag_spdy_use_hpack_decoder2 = false; // Use //net/http2/hpack/decoder as complete HPACK decoder. bool FLAGS_chromium_http2_flag_spdy_use_hpack_decoder3 = true; -// If true, increase HPACK table size up to optimal size kOptTableSize if -// clients allow it. -bool FLAGS_chromium_reloadable_flag_increase_hpack_table_size = false; - // Use Http2FrameDecoderAdapter. // TODO(jamessynge): Remove flag once no longer set by scripts. bool FLAGS_chromium_http2_flag_spdy_use_http2_frame_decoder_adapter = false; diff --git a/net/spdy/spdy_flags.h b/net/spdy/spdy_flags.h index a38fdac3a42fcc..a660235bf49744 100644 --- a/net/spdy/spdy_flags.h +++ b/net/spdy/spdy_flags.h @@ -15,8 +15,6 @@ NET_EXPORT_PRIVATE extern bool FLAGS_chromium_http2_flag_spdy_use_hpack_decoder2; NET_EXPORT_PRIVATE extern bool FLAGS_chromium_http2_flag_spdy_use_hpack_decoder3; -NET_EXPORT_PRIVATE extern bool - FLAGS_chromium_reloadable_flag_increase_hpack_table_size; NET_EXPORT_PRIVATE extern bool FLAGS_use_http2_frame_decoder_adapter; NET_EXPORT_PRIVATE extern bool FLAGS_use_nested_spdy_framer_decoder; NET_EXPORT_PRIVATE extern bool