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

Side by Side Diff: tools/ipc_fuzzer/mutate/mutate.cc

Issue 631653002: Replacing the OVERRIDE with override in tools folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Corrected patch-set-1 Created 6 years, 2 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 | « tools/ipc_fuzzer/mutate/generate.cc ('k') | tools/ipc_fuzzer/replay/replay_process.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <stdlib.h> 5 #include <stdlib.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <iostream> 8 #include <iostream>
9 #include <ostream> 9 #include <ostream>
10 #include <set> 10 #include <set>
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 // One such fuzzer implementation. 89 // One such fuzzer implementation.
90 class DefaultFuzzer : public Fuzzer { 90 class DefaultFuzzer : public Fuzzer {
91 public: 91 public:
92 DefaultFuzzer(int frequency) : frequency_(frequency) { 92 DefaultFuzzer(int frequency) : frequency_(frequency) {
93 } 93 }
94 94
95 virtual ~DefaultFuzzer() {} 95 virtual ~DefaultFuzzer() {}
96 96
97 virtual void FuzzBool(bool* value) OVERRIDE { 97 virtual void FuzzBool(bool* value) override {
98 if (RandEvent(frequency_)) 98 if (RandEvent(frequency_))
99 (*value) = !(*value); 99 (*value) = !(*value);
100 } 100 }
101 101
102 virtual void FuzzInt(int* value) OVERRIDE { 102 virtual void FuzzInt(int* value) override {
103 FuzzIntegralType<int>(value, frequency_); 103 FuzzIntegralType<int>(value, frequency_);
104 } 104 }
105 105
106 virtual void FuzzLong(long* value) OVERRIDE { 106 virtual void FuzzLong(long* value) override {
107 FuzzIntegralType<long>(value, frequency_); 107 FuzzIntegralType<long>(value, frequency_);
108 } 108 }
109 109
110 virtual void FuzzSize(size_t* value) OVERRIDE { 110 virtual void FuzzSize(size_t* value) override {
111 FuzzIntegralType<size_t>(value, frequency_); 111 FuzzIntegralType<size_t>(value, frequency_);
112 } 112 }
113 113
114 virtual void FuzzUChar(unsigned char* value) OVERRIDE { 114 virtual void FuzzUChar(unsigned char* value) override {
115 FuzzIntegralType<unsigned char>(value, frequency_); 115 FuzzIntegralType<unsigned char>(value, frequency_);
116 } 116 }
117 117
118 virtual void FuzzUInt16(uint16* value) OVERRIDE { 118 virtual void FuzzUInt16(uint16* value) override {
119 FuzzIntegralType<uint16>(value, frequency_); 119 FuzzIntegralType<uint16>(value, frequency_);
120 } 120 }
121 121
122 virtual void FuzzUInt32(uint32* value) OVERRIDE { 122 virtual void FuzzUInt32(uint32* value) override {
123 FuzzIntegralType<uint32>(value, frequency_); 123 FuzzIntegralType<uint32>(value, frequency_);
124 } 124 }
125 125
126 virtual void FuzzInt64(int64* value) OVERRIDE { 126 virtual void FuzzInt64(int64* value) override {
127 FuzzIntegralType<int64>(value, frequency_); 127 FuzzIntegralType<int64>(value, frequency_);
128 } 128 }
129 129
130 virtual void FuzzUInt64(uint64* value) OVERRIDE { 130 virtual void FuzzUInt64(uint64* value) override {
131 FuzzIntegralType<uint64>(value, frequency_); 131 FuzzIntegralType<uint64>(value, frequency_);
132 } 132 }
133 133
134 virtual void FuzzFloat(float* value) OVERRIDE { 134 virtual void FuzzFloat(float* value) override {
135 if (RandEvent(frequency_)) 135 if (RandEvent(frequency_))
136 *value = RandDouble(); 136 *value = RandDouble();
137 } 137 }
138 138
139 virtual void FuzzDouble(double* value) OVERRIDE { 139 virtual void FuzzDouble(double* value) override {
140 if (RandEvent(frequency_)) 140 if (RandEvent(frequency_))
141 *value = RandDouble(); 141 *value = RandDouble();
142 } 142 }
143 143
144 virtual void FuzzString(std::string* value) OVERRIDE { 144 virtual void FuzzString(std::string* value) override {
145 FuzzStringType<std::string>(value, frequency_, "BORKED", std::string()); 145 FuzzStringType<std::string>(value, frequency_, "BORKED", std::string());
146 } 146 }
147 147
148 virtual void FuzzString16(base::string16* value) OVERRIDE { 148 virtual void FuzzString16(base::string16* value) override {
149 FuzzStringType<base::string16>(value, frequency_, 149 FuzzStringType<base::string16>(value, frequency_,
150 base::WideToUTF16(L"BORKED"), 150 base::WideToUTF16(L"BORKED"),
151 base::WideToUTF16(L"")); 151 base::WideToUTF16(L""));
152 } 152 }
153 153
154 virtual void FuzzData(char* data, int length) OVERRIDE { 154 virtual void FuzzData(char* data, int length) override {
155 if (RandEvent(frequency_)) { 155 if (RandEvent(frequency_)) {
156 for (int i = 0; i < length; ++i) { 156 for (int i = 0; i < length; ++i) {
157 FuzzIntegralType<char>(&data[i], frequency_); 157 FuzzIntegralType<char>(&data[i], frequency_);
158 } 158 }
159 } 159 }
160 } 160 }
161 161
162 virtual void FuzzBytes(void* data, int data_len) OVERRIDE { 162 virtual void FuzzBytes(void* data, int data_len) override {
163 FuzzData(static_cast<char*>(data), data_len); 163 FuzzData(static_cast<char*>(data), data_len);
164 } 164 }
165 165
166 private: 166 private:
167 unsigned int frequency_; 167 unsigned int frequency_;
168 }; 168 };
169 169
170 170
171 // No-op fuzzer. Rewrites each message unchanged to check if the message 171 // No-op fuzzer. Rewrites each message unchanged to check if the message
172 // re-assembly is legit. 172 // re-assembly is legit.
173 class NoOpFuzzer : public Fuzzer { 173 class NoOpFuzzer : public Fuzzer {
174 public: 174 public:
175 NoOpFuzzer() {} 175 NoOpFuzzer() {}
176 virtual ~NoOpFuzzer() {} 176 virtual ~NoOpFuzzer() {}
177 177
178 virtual void FuzzBool(bool* value) OVERRIDE {} 178 virtual void FuzzBool(bool* value) override {}
179 virtual void FuzzInt(int* value) OVERRIDE {} 179 virtual void FuzzInt(int* value) override {}
180 virtual void FuzzLong(long* value) OVERRIDE {} 180 virtual void FuzzLong(long* value) override {}
181 virtual void FuzzSize(size_t* value) OVERRIDE {} 181 virtual void FuzzSize(size_t* value) override {}
182 virtual void FuzzUChar(unsigned char* value) OVERRIDE {} 182 virtual void FuzzUChar(unsigned char* value) override {}
183 virtual void FuzzUInt16(uint16* value) OVERRIDE {} 183 virtual void FuzzUInt16(uint16* value) override {}
184 virtual void FuzzUInt32(uint32* value) OVERRIDE {} 184 virtual void FuzzUInt32(uint32* value) override {}
185 virtual void FuzzInt64(int64* value) OVERRIDE {} 185 virtual void FuzzInt64(int64* value) override {}
186 virtual void FuzzUInt64(uint64* value) OVERRIDE {} 186 virtual void FuzzUInt64(uint64* value) override {}
187 virtual void FuzzFloat(float* value) OVERRIDE {} 187 virtual void FuzzFloat(float* value) override {}
188 virtual void FuzzDouble(double* value) OVERRIDE {} 188 virtual void FuzzDouble(double* value) override {}
189 virtual void FuzzString(std::string* value) OVERRIDE {} 189 virtual void FuzzString(std::string* value) override {}
190 virtual void FuzzString16(base::string16* value) OVERRIDE {} 190 virtual void FuzzString16(base::string16* value) override {}
191 virtual void FuzzData(char* data, int length) OVERRIDE {} 191 virtual void FuzzData(char* data, int length) override {}
192 virtual void FuzzBytes(void* data, int data_len) OVERRIDE {} 192 virtual void FuzzBytes(void* data, int data_len) override {}
193 }; 193 };
194 194
195 class FuzzerFactory { 195 class FuzzerFactory {
196 public: 196 public:
197 static Fuzzer *Create(const std::string& name, int frequency) { 197 static Fuzzer *Create(const std::string& name, int frequency) {
198 if (name == "no-op") 198 if (name == "no-op")
199 return new NoOpFuzzer(); 199 return new NoOpFuzzer();
200 200
201 if (name == "default") 201 if (name == "default")
202 return new DefaultFuzzer(frequency); 202 return new DefaultFuzzer(frequency);
(...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 return EXIT_FAILURE; 720 return EXIT_FAILURE;
721 721
722 return EXIT_SUCCESS; 722 return EXIT_SUCCESS;
723 } 723 }
724 724
725 } // namespace ipc_fuzzer 725 } // namespace ipc_fuzzer
726 726
727 int main(int argc, char** argv) { 727 int main(int argc, char** argv) {
728 return ipc_fuzzer::MutateMain(argc, argv); 728 return ipc_fuzzer::MutateMain(argc, argv);
729 } 729 }
OLDNEW
« no previous file with comments | « tools/ipc_fuzzer/mutate/generate.cc ('k') | tools/ipc_fuzzer/replay/replay_process.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698