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

Side by Side Diff: content/common/set_ipc_fuzzing.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, 8 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 "content/common/set_ipc_fuzzing.h"
6
7 #if defined(OS_LINUX)
8 #include <dlfcn.h>
9 #endif
10
11 typedef IPC::SyncChannel::OutgoingMessageFilter *(*GetFuzzerFunction)();
12 const char kFuzzLibraryName[] = "libipcfuzz.so";
13 const char kFuzzEntryPointName[] = "GetFilter";
14
15 void SetIPCFuzzing(IPC::SyncChannel *channel) {
16
17 #if defined(OS_LINUX)
18 // Fuzz is currently linux-only feature
19 void *fuzz_library = dlopen(kFuzzLibraryName, RTLD_LAZY);
20 if (fuzz_library) {
21 GetFuzzerFunction fuzz_entry_point = reinterpret_cast<GetFuzzerFunction>(
22 dlsym(fuzz_library, kFuzzEntryPointName));
23
24 if (fuzz_entry_point)
25 channel->set_outgoing_message_filter(fuzz_entry_point());
26 }
27 #endif // OS_LINUX
28
29 }
30
31
32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698