| OLD | NEW |
| 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. | 11 // This file is intended to provide a common interface for fuzzing functions. |
| 12 // It's intended to set sane defaults, such as removing logging for further | 12 // It's intended to set sane defaults, such as removing logging for further |
| 13 // fuzzing efficiency. | 13 // fuzzing efficiency. |
| 14 | 14 |
| 15 #include "webrtc/base/logging.h" | 15 #include "webrtc/rtc_base/logging.h" |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 bool g_initialized = false; | 18 bool g_initialized = false; |
| 19 void InitializeWebRtcFuzzDefaults() { | 19 void InitializeWebRtcFuzzDefaults() { |
| 20 if (g_initialized) | 20 if (g_initialized) |
| 21 return; | 21 return; |
| 22 | 22 |
| 23 // Remove default logging to prevent huge slowdowns. | 23 // Remove default logging to prevent huge slowdowns. |
| 24 // TODO(pbos): Disable in Chromium: http://crbug.com/561667 | 24 // TODO(pbos): Disable in Chromium: http://crbug.com/561667 |
| 25 #if !defined(WEBRTC_CHROMIUM_BUILD) | 25 #if !defined(WEBRTC_CHROMIUM_BUILD) |
| 26 rtc::LogMessage::LogToDebug(rtc::LS_NONE); | 26 rtc::LogMessage::LogToDebug(rtc::LS_NONE); |
| 27 #endif // !defined(WEBRTC_CHROMIUM_BUILD) | 27 #endif // !defined(WEBRTC_CHROMIUM_BUILD) |
| 28 | 28 |
| 29 g_initialized = true; | 29 g_initialized = true; |
| 30 } | 30 } |
| 31 } | 31 } |
| 32 | 32 |
| 33 namespace webrtc { | 33 namespace webrtc { |
| 34 extern void FuzzOneInput(const uint8_t* data, size_t size); | 34 extern void FuzzOneInput(const uint8_t* data, size_t size); |
| 35 } // namespace webrtc | 35 } // namespace webrtc |
| 36 | 36 |
| 37 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { | 37 extern "C" int LLVMFuzzerTestOneInput(const unsigned char *data, size_t size) { |
| 38 InitializeWebRtcFuzzDefaults(); | 38 InitializeWebRtcFuzzDefaults(); |
| 39 webrtc::FuzzOneInput(data, size); | 39 webrtc::FuzzOneInput(data, size); |
| 40 return 0; | 40 return 0; |
| 41 } | 41 } |
| OLD | NEW |