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 1306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1317 }; | 1317 }; |
1318 #endif | 1318 #endif |
1319 | 1319 |
1320 template <> | 1320 template <> |
1321 struct FuzzTraits<IPC::ChannelHandle> { | 1321 struct FuzzTraits<IPC::ChannelHandle> { |
1322 static bool Fuzz(IPC::ChannelHandle* p, Fuzzer* fuzzer) { | 1322 static bool Fuzz(IPC::ChannelHandle* p, Fuzzer* fuzzer) { |
1323 // TODO(mbarbella): Support mutation. | 1323 // TODO(mbarbella): Support mutation. |
1324 if (!fuzzer->ShouldGenerate()) | 1324 if (!fuzzer->ShouldGenerate()) |
1325 return true; | 1325 return true; |
1326 | 1326 |
1327 // TODO(inferno): Add way to generate real channel handles. | 1327 return FuzzParam(&p->mojo_handle, fuzzer); |
1328 #if defined(OS_WIN) | |
1329 HANDLE fake_handle = (HANDLE)(RandU64()); | |
1330 p->pipe = IPC::ChannelHandle::PipeHandle(fake_handle); | |
1331 return true; | |
1332 #elif defined(OS_POSIX) | |
1333 return | |
1334 FuzzParam(&p->name, fuzzer) && | |
1335 FuzzParam(&p->socket, fuzzer); | |
1336 #endif | |
1337 } | 1328 } |
1338 }; | 1329 }; |
1339 | 1330 |
1340 #if defined(OS_WIN) | 1331 #if defined(OS_WIN) |
1341 template <> | 1332 template <> |
1342 struct FuzzTraits<LOGFONT> { | 1333 struct FuzzTraits<LOGFONT> { |
1343 static bool Fuzz(LOGFONT* p, Fuzzer* fuzzer) { | 1334 static bool Fuzz(LOGFONT* p, Fuzzer* fuzzer) { |
1344 // TODO(aarya): This should actually do something. | 1335 // TODO(aarya): This should actually do something. |
1345 return true; | 1336 return true; |
1346 } | 1337 } |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2008 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" | 1999 #include "tools/ipc_fuzzer/message_lib/all_message_null_macros.h" |
2009 #undef IPC_MESSAGE_DECL | 2000 #undef IPC_MESSAGE_DECL |
2010 #define IPC_MESSAGE_DECL(name, ...) \ | 2001 #define IPC_MESSAGE_DECL(name, ...) \ |
2011 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; | 2002 (*map)[static_cast<uint32_t>(name::ID)] = FuzzerHelper<name>::Fuzz; |
2012 | 2003 |
2013 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { | 2004 void PopulateFuzzerFunctionMap(FuzzerFunctionMap* map) { |
2014 #include "tools/ipc_fuzzer/message_lib/all_messages.h" | 2005 #include "tools/ipc_fuzzer/message_lib/all_messages.h" |
2015 } | 2006 } |
2016 | 2007 |
2017 } // namespace ipc_fuzzer | 2008 } // namespace ipc_fuzzer |
OLD | NEW |