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

Side by Side Diff: webrtc/test/fuzzers/webrtc_fuzzer_main.cc

Issue 1529203003: Add DrFuzz support to webrtc fuzzers. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « webrtc/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 // This file is intended to provide a common interface for fuzzing functions, so 11 // This file is intended to provide a common interface for fuzzing functions.
12 // whether we're running fuzzing under libFuzzer or DrFuzz the webrtc functions 12 // It's intended to set sane defaults, such as removing logging for further
kjellander_webrtc 2015/12/16 22:10:26 So no changes were actually needed for DrFuzz?
pbos-webrtc 2015/12/16 22:13:20 No, zhaoqin@ added upstream support for drfuzz und
13 // can remain the same. 13 // fuzzing efficiency.
14 // TODO(pbos): Implement FuzzOneInput() for more than one platform (currently
15 // libFuzzer).
16 14
17 #include "webrtc/base/logging.h" 15 #include "webrtc/base/logging.h"
18 16
19 namespace { 17 namespace {
20 bool g_initialized = false; 18 bool g_initialized = false;
21 void InitializeWebRtcFuzzDefaults() { 19 void InitializeWebRtcFuzzDefaults() {
22 if (g_initialized) 20 if (g_initialized)
23 return; 21 return;
24 22
25 // Remove default logging to prevent huge slowdowns. 23 // Remove default logging to prevent huge slowdowns.
26 // TODO(pbos): Disable in Chromium: http://crbug.com/561667 24 // TODO(pbos): Disable in Chromium: http://crbug.com/561667
27 #if !defined(WEBRTC_CHROMIUM_BUILD) 25 #if !defined(WEBRTC_CHROMIUM_BUILD)
28 rtc::LogMessage::LogToDebug(rtc::LS_NONE); 26 rtc::LogMessage::LogToDebug(rtc::LS_NONE);
29 #endif // !defined(WEBRTC_CHROMIUM_BUILD) 27 #endif // !defined(WEBRTC_CHROMIUM_BUILD)
30 28
31 g_initialized = true; 29 g_initialized = true;
32 } 30 }
33 } 31 }
34 32
35 namespace webrtc { 33 namespace webrtc {
36 extern void FuzzOneInput(const uint8_t* data, size_t size); 34 extern void FuzzOneInput(const uint8_t* data, size_t size);
37 } // namespace webrtc 35 } // namespace webrtc
38 36
39 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { 37 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) {
40 InitializeWebRtcFuzzDefaults(); 38 InitializeWebRtcFuzzDefaults();
41 webrtc::FuzzOneInput(data, size); 39 webrtc::FuzzOneInput(data, size);
42 return 0; 40 return 0;
43 } 41 }
OLDNEW
« no previous file with comments | « webrtc/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698