Chromium Code Reviews| Index: testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc |
| diff --git a/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc b/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7a891eefae9248c50fea7f9b3957d081a181af9e |
| --- /dev/null |
| +++ b/testing/libfuzzer/fuzzers/media_pipeline_fuzzer.cc |
| @@ -0,0 +1,37 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
xhwang
2016/03/02 00:57:04
What's the recommendation about the location of th
kcc2
2016/03/02 01:00:11
My recommendation is to keep the fuzzing targets c
xhwang
2016/03/02 01:20:41
Done.
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/at_exit.h" |
| +#include "base/command_line.h" |
| +#include "base/logging.h" |
| +#include "media/base/pipeline_status.h" |
| +#include "media/test/pipeline_integration_test_base.h" |
| + |
| +// Entry point for LibFuzzer. |
| +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { |
| + // Media pipeline starts new threads, which needs AtExitManager. |
| + base::AtExitManager at_exit; |
| + |
| + // Media pipeline checks command line arguments internally. |
| + base::CommandLine::Init(0, NULL); |
|
DaleCurtis
2016/03/02 01:05:39
nullptr ?
xhwang
2016/03/02 01:20:41
Done.
|
| + |
| + media::PipelineIntegrationTestBase test; |
| + |
| + DVLOG(1) << "Start"; |
|
kcc2
2016/03/02 01:00:11
No logging please -- it just slows down fuzzing.
xhwang
2016/03/02 01:20:41
Done.
|
| + media::PipelineStatus pipeline_status = |
| + test.Start(data, size, media::PipelineIntegrationTestBase::kClockless); |
| + if (pipeline_status != media::PIPELINE_OK) |
| + return 0; |
| + |
| + DVLOG(1) << "Play"; |
| + test.Play(); |
| + pipeline_status = test.WaitUntilEndedOrError(); |
| + if (pipeline_status != media::PIPELINE_OK) |
| + return 0; |
| + |
| + DVLOG(1) << "Seek"; |
| + test.Seek(base::TimeDelta::FromMilliseconds(0)); |
|
DaleCurtis
2016/03/02 01:05:39
Also just base::TimeDelta() here.
xhwang
2016/03/02 01:20:41
Done.
|
| + |
| + return 0; |
| +} |