Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: net/spdy/fuzzing/hpack_fuzz_util.cc

Issue 1263803002: Replace SpdyNameValueBlock typedef with SpdyHeaderBlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/fuzzing/hpack_fuzz_util.h ('k') | net/spdy/fuzzing/hpack_fuzz_util_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/fuzzing/hpack_fuzz_util.h" 5 #include "net/spdy/fuzzing/hpack_fuzz_util.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 9
10 #include "base/rand_util.h" 10 #include "base/rand_util.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 context->values.push_back(""); 65 context->values.push_back("");
66 context->values.push_back("baz=bing; foo=bar; garbage"); 66 context->values.push_back("baz=bing; foo=bar; garbage");
67 context->values.push_back("baz=bing; fizzle=fazzle; garbage"); 67 context->values.push_back("baz=bing; fizzle=fazzle; garbage");
68 context->values.push_back("rudolph=the-red-nosed-reindeer"); 68 context->values.push_back("rudolph=the-red-nosed-reindeer");
69 context->values.push_back("had=a;very_shiny=nose"); 69 context->values.push_back("had=a;very_shiny=nose");
70 context->values.push_back("and\0if\0you\0ever\1saw\0it;"); 70 context->values.push_back("and\0if\0you\0ever\1saw\0it;");
71 context->values.push_back("u; would=even;say-it\xffglows"); 71 context->values.push_back("u; would=even;say-it\xffglows");
72 } 72 }
73 73
74 // static 74 // static
75 map<string, string> HpackFuzzUtil::NextGeneratedHeaderSet( 75 SpdyHeaderBlock HpackFuzzUtil::NextGeneratedHeaderSet(
76 GeneratorContext* context) { 76 GeneratorContext* context) {
77 map<string, string> headers; 77 SpdyHeaderBlock headers;
78 78
79 size_t header_count = 1 + SampleExponential(kHeaderCountMean, 79 size_t header_count = 1 + SampleExponential(kHeaderCountMean,
80 kHeaderCountMax); 80 kHeaderCountMax);
81 for (size_t j = 0; j != header_count; ++j) { 81 for (size_t j = 0; j != header_count; ++j) {
82 size_t name_index = SampleExponential(kHeaderIndexMean, 82 size_t name_index = SampleExponential(kHeaderIndexMean,
83 kHeaderIndexMax); 83 kHeaderIndexMax);
84 size_t value_index = SampleExponential(kHeaderIndexMean, 84 size_t value_index = SampleExponential(kHeaderIndexMean,
85 kHeaderIndexMax); 85 kHeaderIndexMax);
86 string name, value; 86 string name, value;
87 if (name_index >= context->names.size()) { 87 if (name_index >= context->names.size()) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 uint64 bits_to_flip = flip_per_thousand * (1 + buffer_bit_length / 1024); 181 uint64 bits_to_flip = flip_per_thousand * (1 + buffer_bit_length / 1024);
182 182
183 // Iteratively identify & flip offsets in the buffer bit-sequence. 183 // Iteratively identify & flip offsets in the buffer bit-sequence.
184 for (uint64 i = 0; i != bits_to_flip; ++i) { 184 for (uint64 i = 0; i != bits_to_flip; ++i) {
185 uint64 bit_offset = base::RandUint64() % buffer_bit_length; 185 uint64 bit_offset = base::RandUint64() % buffer_bit_length;
186 buffer[bit_offset / 8u] ^= (1 << (bit_offset % 8u)); 186 buffer[bit_offset / 8u] ^= (1 << (bit_offset % 8u));
187 } 187 }
188 } 188 }
189 189
190 } // namespace net 190 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/fuzzing/hpack_fuzz_util.h ('k') | net/spdy/fuzzing/hpack_fuzz_util_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698