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

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

Issue 1535363003: Switch to standard integer types in net/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: stddef Created 5 years 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/buffered_spdy_framer_unittest.cc ('k') | net/spdy/fuzzing/hpack_fuzz_util.h » ('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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file.h" 6 #include "base/files/file.h"
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "net/spdy/fuzzing/hpack_fuzz_util.h" 9 #include "net/spdy/fuzzing/hpack_fuzz_util.h"
10 10
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 base::File file_out(base::FilePath::FromUTF8Unsafe(file_to_write), 58 base::File file_out(base::FilePath::FromUTF8Unsafe(file_to_write),
59 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE); 59 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
60 CHECK(file_out.IsValid()) << file_out.error_details(); 60 CHECK(file_out.IsValid()) << file_out.error_details();
61 61
62 DVLOG(1) << "Flipping " << flip_ratio << " bits per 1024 input bytes"; 62 DVLOG(1) << "Flipping " << flip_ratio << " bits per 1024 input bytes";
63 63
64 size_t block_count = 0; 64 size_t block_count = 0;
65 StringPiece block; 65 StringPiece block;
66 while (HpackFuzzUtil::NextHeaderBlock(&input, &block)) { 66 while (HpackFuzzUtil::NextHeaderBlock(&input, &block)) {
67 HpackFuzzUtil::FlipBits( 67 HpackFuzzUtil::FlipBits(
68 reinterpret_cast<uint8*>(const_cast<char*>(block.data())), 68 reinterpret_cast<uint8_t*>(const_cast<char*>(block.data())),
69 block.size(), 69 block.size(), flip_ratio);
70 flip_ratio);
71 70
72 string prefix = HpackFuzzUtil::HeaderBlockPrefix(block.size()); 71 string prefix = HpackFuzzUtil::HeaderBlockPrefix(block.size());
73 72
74 CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size())); 73 CHECK_LT(0, file_out.WriteAtCurrentPos(prefix.data(), prefix.size()));
75 CHECK_LT(0, file_out.WriteAtCurrentPos(block.data(), block.size())); 74 CHECK_LT(0, file_out.WriteAtCurrentPos(block.data(), block.size()));
76 ++block_count; 75 ++block_count;
77 } 76 }
78 CHECK(file_out.Flush()); 77 CHECK(file_out.Flush());
79 DVLOG(1) << "Mutated " << block_count << " blocks."; 78 DVLOG(1) << "Mutated " << block_count << " blocks.";
80 return 0; 79 return 0;
81 } 80 }
OLDNEW
« no previous file with comments | « net/spdy/buffered_spdy_framer_unittest.cc ('k') | net/spdy/fuzzing/hpack_fuzz_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698