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

Side by Side Diff: chrome/common/external_ipc_fuzzer.cc

Issue 6711024: Example of how to interpose yourself in a message stream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698