Fix fuzzer breakage in Chromium.
Removes log disabling under Chromium which doesn't compile due to missing LS_INFO in the override log implementation. Also removes dependency on webrtc/test/BUILD.gn which doesn't build in Chromium (due to third_party/gflags not being present). Instead the no-op implementation of field_trials in system_wrappers is used. BUG=chromium:561667, webrtc:4771 R=kjellander@webrtc.org TBR=henrikg@webrtc.org Review URL: https://codereview.webrtc.org/1473713004 . Cr-Commit-Position: refs/heads/master@{#10793}
This commit is contained in:
parent
11e022904d
commit
89d658f6b4
@ -14,7 +14,7 @@ static_library("webrtc_fuzzer_main") {
|
||||
"webrtc_fuzzer_main.cc",
|
||||
]
|
||||
deps = [
|
||||
"..:field_trial",
|
||||
"../../system_wrappers:field_trial_default",
|
||||
"//testing/libfuzzer:libfuzzer_main",
|
||||
]
|
||||
}
|
||||
|
||||
@ -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,30 @@
|
||||
// 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)
|
||||
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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user