| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <iostream> | 5 #include <iostream> |
| 6 #include <set> | 6 #include <set> |
| 7 #include <string> | 7 #include <string> |
| 8 #include <tuple> | 8 #include <tuple> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 ++g_depth; | 502 ++g_depth; |
| 503 size_t list_length = p->GetSize(); | 503 size_t list_length = p->GetSize(); |
| 504 if (fuzzer->ShouldGenerate()) | 504 if (fuzzer->ShouldGenerate()) |
| 505 list_length = g_depth > 3 ? 0 : RandInRange(8); | 505 list_length = g_depth > 3 ? 0 : RandInRange(8); |
| 506 for (size_t index = 0; index < list_length; ++index) { | 506 for (size_t index = 0; index < list_length; ++index) { |
| 507 switch (static_cast<base::Value::Type>(RandInRange(8))) { | 507 switch (static_cast<base::Value::Type>(RandInRange(8))) { |
| 508 case base::Value::Type::BOOLEAN: { | 508 case base::Value::Type::BOOLEAN: { |
| 509 bool tmp; | 509 bool tmp; |
| 510 p->GetBoolean(index, &tmp); | 510 p->GetBoolean(index, &tmp); |
| 511 fuzzer->FuzzBool(&tmp); | 511 fuzzer->FuzzBool(&tmp); |
| 512 p->Set(index, new base::FundamentalValue(tmp)); | 512 p->Set(index, new base::Value(tmp)); |
| 513 break; | 513 break; |
| 514 } | 514 } |
| 515 case base::Value::Type::INTEGER: { | 515 case base::Value::Type::INTEGER: { |
| 516 int tmp; | 516 int tmp; |
| 517 p->GetInteger(index, &tmp); | 517 p->GetInteger(index, &tmp); |
| 518 fuzzer->FuzzInt(&tmp); | 518 fuzzer->FuzzInt(&tmp); |
| 519 p->Set(index, new base::FundamentalValue(tmp)); | 519 p->Set(index, new base::Value(tmp)); |
| 520 break; | 520 break; |
| 521 } | 521 } |
| 522 case base::Value::Type::DOUBLE: { | 522 case base::Value::Type::DOUBLE: { |
| 523 double tmp; | 523 double tmp; |
| 524 p->GetDouble(index, &tmp); | 524 p->GetDouble(index, &tmp); |
| 525 fuzzer->FuzzDouble(&tmp); | 525 fuzzer->FuzzDouble(&tmp); |
| 526 p->Set(index, new base::FundamentalValue(tmp)); | 526 p->Set(index, new base::Value(tmp)); |
| 527 break; | 527 break; |
| 528 } | 528 } |
| 529 case base::Value::Type::STRING: { | 529 case base::Value::Type::STRING: { |
| 530 std::string tmp; | 530 std::string tmp; |
| 531 p->GetString(index, &tmp); | 531 p->GetString(index, &tmp); |
| 532 fuzzer->FuzzString(&tmp); | 532 fuzzer->FuzzString(&tmp); |
| 533 p->Set(index, new base::StringValue(tmp)); | 533 p->Set(index, new base::StringValue(tmp)); |
| 534 break; | 534 break; |
| 535 } | 535 } |
| 536 case base::Value::Type::BINARY: { | 536 case base::Value::Type::BINARY: { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 | 574 |
| 575 ++g_depth; | 575 ++g_depth; |
| 576 size_t dict_length = g_depth > 3 ? 0 : RandInRange(8); | 576 size_t dict_length = g_depth > 3 ? 0 : RandInRange(8); |
| 577 for (size_t index = 0; index < dict_length; ++index) { | 577 for (size_t index = 0; index < dict_length; ++index) { |
| 578 std::string property; | 578 std::string property; |
| 579 fuzzer->FuzzString(&property); | 579 fuzzer->FuzzString(&property); |
| 580 switch (static_cast<base::Value::Type>(RandInRange(8))) { | 580 switch (static_cast<base::Value::Type>(RandInRange(8))) { |
| 581 case base::Value::Type::BOOLEAN: { | 581 case base::Value::Type::BOOLEAN: { |
| 582 bool tmp; | 582 bool tmp; |
| 583 fuzzer->FuzzBool(&tmp); | 583 fuzzer->FuzzBool(&tmp); |
| 584 p->SetWithoutPathExpansion(property, new base::FundamentalValue(tmp)); | 584 p->SetWithoutPathExpansion(property, new base::Value(tmp)); |
| 585 break; | 585 break; |
| 586 } | 586 } |
| 587 case base::Value::Type::INTEGER: { | 587 case base::Value::Type::INTEGER: { |
| 588 int tmp; | 588 int tmp; |
| 589 fuzzer->FuzzInt(&tmp); | 589 fuzzer->FuzzInt(&tmp); |
| 590 p->SetWithoutPathExpansion(property, new base::FundamentalValue(tmp)); | 590 p->SetWithoutPathExpansion(property, new base::Value(tmp)); |
| 591 break; | 591 break; |
| 592 } | 592 } |
| 593 case base::Value::Type::DOUBLE: { | 593 case base::Value::Type::DOUBLE: { |
| 594 double tmp; | 594 double tmp; |
| 595 fuzzer->FuzzDouble(&tmp); | 595 fuzzer->FuzzDouble(&tmp); |
| 596 p->SetWithoutPathExpansion(property, new base::FundamentalValue(tmp)); | 596 p->SetWithoutPathExpansion(property, new base::Value(tmp)); |
| 597 break; | 597 break; |
| 598 } | 598 } |
| 599 case base::Value::Type::STRING: { | 599 case base::Value::Type::STRING: { |
| 600 std::string tmp; | 600 std::string tmp; |
| 601 fuzzer->FuzzString(&tmp); | 601 fuzzer->FuzzString(&tmp); |
| 602 p->SetWithoutPathExpansion(property, new base::StringValue(tmp)); | 602 p->SetWithoutPathExpansion(property, new base::StringValue(tmp)); |
| 603 break; | 603 break; |
| 604 } | 604 } |
| 605 case base::Value::Type::BINARY: { | 605 case base::Value::Type::BINARY: { |
| 606 char tmp[200]; | 606 char tmp[200]; |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1823 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 1823 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
| 1824 #undef IPC_MESSAGE_DECL | 1824 #undef IPC_MESSAGE_DECL |
| 1825 #define IPC_MESSAGE_DECL(name, ...) \ | 1825 #define IPC_MESSAGE_DECL(name, ...) \ |
| 1826 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; | 1826 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; |
| 1827 | 1827 |
| 1828 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 1828 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
| 1829 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 1829 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 } // namespace ipc_fuzzer | 1832 } // namespace ipc_fuzzer |
| OLD | NEW |