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