OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/common/external_ipc_fuzzer.h" |
| 6 |
| 7 #if defined(OS_LINUX) |
| 8 #include <dlfcn.h> |
| 9 #endif |
| 10 |
| 11 typedef IPC::ChannelProxy::OutgoingMessageFilter *(*GetFuzzerFunction)(); |
| 12 const char kFuzzLibraryName[] = "libipcfuzz.so"; |
| 13 const char kFuzzEntryName[] = "GetFilter"; |
| 14 |
| 15 IPC::ChannelProxy::OutgoingMessageFilter* LoadExternalIPCFuzzer() { |
| 16 IPC::ChannelProxy::OutgoingMessageFilter* result = NULL; |
| 17 |
| 18 #if defined(OS_LINUX) |
| 19 |
| 20 // Fuzz is currently linux-only feature |
| 21 void *fuzz_library = dlopen(kFuzzLibraryName, RTLD_NOW); |
| 22 if (fuzz_library) { |
| 23 GetFuzzerFunction fuzz_entry_point = |
| 24 reinterpret_cast<GetFuzzerFunction>( |
| 25 dlsym(fuzz_library, kFuzzEntryName)); |
| 26 |
| 27 if (fuzz_entry_point) |
| 28 result = fuzz_entry_point(); |
| 29 } |
| 30 |
| 31 if (!result) |
| 32 LOG(WARNING) << dlerror() << "\n"; |
| 33 |
| 34 #endif // OS_LINUX |
| 35 |
| 36 return result; |
| 37 } |
| 38 |
| 39 |
| 40 |
OLD | NEW |