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

Unified Diff: webrtc/test/fuzzers/webrtc_fuzzer_main.cc

Issue 1473713004: Fix fuzzer breakage in Chromium. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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
« no previous file with comments | « webrtc/test/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/test/fuzzers/webrtc_fuzzer_main.cc
diff --git a/webrtc/test/fuzzers/webrtc_fuzzer_main.cc b/webrtc/test/fuzzers/webrtc_fuzzer_main.cc
index 9c29a5dc57fca61238a6c66fc4e55ea3f8e72467..4dac7329104ad39e9a944ea5416e884d0e76f4d2 100644
--- a/webrtc/test/fuzzers/webrtc_fuzzer_main.cc
+++ b/webrtc/test/fuzzers/webrtc_fuzzer_main.cc
@@ -7,7 +7,6 @@
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
-#include "webrtc/base/logging.h"
// This file is intended to provide a common interface for fuzzing functions, so
// whether we're running fuzzing under libFuzzer or DrFuzz the webrtc functions
@@ -15,15 +14,28 @@
// TODO(pbos): Implement FuzzOneInput() for more than one platform (currently
// libFuzzer).
+#include "webrtc/base/logging.h"
+
+namespace {
+bool g_initialized = false;
+void InitializeWebRtcFuzzDefaults() {
+ if (g_initialized)
+ return;
+ // Remove default logging to prevent huge slowdowns.
+ // TODO(pbos): Disable in Chromium: http://crbug.com/561667
+#if !defined(WEBRTC_CHROMIUM_BUILD)
Henrik Grunell WebRTC 2015/11/26 12:06:00 Do you plan to modify this function when disabling
pbos-webrtc 2015/11/26 12:23:42 This exact code should work in Chromium, but curre
Henrik Grunell WebRTC 2015/11/26 12:59:58 I see. It wasn't really clear reading the todo. :)
+ rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+#endif // !defined(WEBRTC_CHROMIUM_BUILD)
+ g_initialized = true;
+}
+}
+
namespace webrtc {
extern void FuzzOneInput(const uint8_t* data, size_t size);
} // namespace webrtc
extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
- // TODO(pbos): Figure out whether this can be moved to common startup code and
- // not be done per-input.
- // Remove default logging to prevent huge slowdowns.
- rtc::LogMessage::LogToDebug(rtc::LS_NONE);
+ InitializeWebRtcFuzzDefaults();
webrtc::FuzzOneInput(data, size);
return 0;
}
« no previous file with comments | « webrtc/test/fuzzers/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698