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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/common/set_ipc_fuzzing.cc
===================================================================
--- content/common/set_ipc_fuzzing.cc (revision 0)
+++ content/common/set_ipc_fuzzing.cc (revision 0)
@@ -0,0 +1,32 @@
+// 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 "content/common/set_ipc_fuzzing.h"
+
+#if defined(OS_LINUX)
+#include <dlfcn.h>
+#endif
+
+typedef IPC::SyncChannel::OutgoingMessageFilter *(*GetFuzzerFunction)();
+const char kFuzzLibraryName[] = "libipcfuzz.so";
+const char kFuzzEntryPointName[] = "GetFilter";
+
+void SetIPCFuzzing(IPC::SyncChannel *channel) {
+
+#if defined(OS_LINUX)
+ // Fuzz is currently linux-only feature
+ void *fuzz_library = dlopen(kFuzzLibraryName, RTLD_LAZY);
+ if (fuzz_library) {
+ GetFuzzerFunction fuzz_entry_point = reinterpret_cast<GetFuzzerFunction>(
+ dlsym(fuzz_library, kFuzzEntryPointName));
+
+ if (fuzz_entry_point)
+ channel->set_outgoing_message_filter(fuzz_entry_point());
+ }
+#endif // OS_LINUX
+
+}
+
+
+
Property changes on: content/common/set_ipc_fuzzing.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698