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

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

Issue 871933003: Limit the number of items generated in maps during IPC fuzzing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 | « no previous file | no next file » | 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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 --g_depth; 403 --g_depth;
404 return true; 404 return true;
405 } 405 }
406 }; 406 };
407 407
408 408
409 template <class A, class B> 409 template <class A, class B>
410 struct GenerateTraits<std::map<A, B> > { 410 struct GenerateTraits<std::map<A, B> > {
411 static bool Generate(std::map<A, B>* p, Generator* generator) { 411 static bool Generate(std::map<A, B>* p, Generator* generator) {
412 static int g_depth = 0; 412 static int g_depth = 0;
413 size_t count = ++g_depth > 3 ? 0 : RandInRange(20); 413 size_t count = ++g_depth > 3 ? 0 : RandInRange(10);
414 std::pair<A, B> place_holder; 414 std::pair<A, B> place_holder;
415 for (size_t i = 0; i < count; ++i) { 415 for (size_t i = 0; i < count; ++i) {
416 if (!GenerateParam(&place_holder, generator)) { 416 if (!GenerateParam(&place_holder, generator)) {
417 --g_depth; 417 --g_depth;
418 return false; 418 return false;
419 } 419 }
420 p->insert(place_holder); 420 p->insert(place_holder);
421 } 421 }
422 --g_depth; 422 --g_depth;
423 return true; 423 return true;
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 return EXIT_FAILURE; 1414 return EXIT_FAILURE;
1415 1415
1416 return EXIT_SUCCESS; 1416 return EXIT_SUCCESS;
1417 } 1417 }
1418 1418
1419 } // namespace ipc_fuzzer 1419 } // namespace ipc_fuzzer
1420 1420
1421 int main(int argc, char** argv) { 1421 int main(int argc, char** argv) {
1422 return ipc_fuzzer::GenerateMain(argc, argv); 1422 return ipc_fuzzer::GenerateMain(argc, argv);
1423 } 1423 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698