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

Unified 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, 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: chrome/common/external_ipc_fuzzer.cc
===================================================================
--- chrome/common/external_ipc_fuzzer.cc (revision 0)
+++ chrome/common/external_ipc_fuzzer.cc (revision 0)
@@ -0,0 +1,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;
+}
+
+
+
Property changes on: chrome/common/external_ipc_fuzzer.cc
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698