| Index: media/test/pipeline_integration_fuzzertest.cc
|
| diff --git a/media/test/pipeline_integration_fuzzertest.cc b/media/test/pipeline_integration_fuzzertest.cc
|
| index a00b3281a9b3fb935cb52dbebeb3c28c1a1c2e55..508cf36294a81edc99260467f5f0f2cc5a09ac23 100644
|
| --- a/media/test/pipeline_integration_fuzzertest.cc
|
| +++ b/media/test/pipeline_integration_fuzzertest.cc
|
| @@ -4,13 +4,31 @@
|
|
|
| #include <stddef.h>
|
| #include <stdint.h>
|
| +#include <vector>
|
|
|
| #include "base/at_exit.h"
|
| +#include "base/bind.h"
|
| #include "base/command_line.h"
|
| #include "base/logging.h"
|
| +#include "media/base/eme_constants.h"
|
| #include "media/base/pipeline_status.h"
|
| #include "media/test/pipeline_integration_test_base.h"
|
|
|
| +namespace {
|
| +
|
| +void OnEncryptedMediaInitData(media::PipelineIntegrationTestBase* test,
|
| + media::EmeInitDataType /* type */,
|
| + const std::vector<uint8_t>& /* init_data */) {
|
| + // Encrypted media is not supported in this test. For an encrypted media file,
|
| + // we will start demuxing the data but media pipeline will wait for a CDM to
|
| + // be available to start initialization, which will not happen in this case.
|
| + // To prevent the test timeout, we'll just fail the test immediately here.
|
| + // TODO(xhwang): Support encrypted media in this fuzzer test.
|
| + test->FailTest(media::PIPELINE_ERROR_INITIALIZATION_FAILED);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| // Entry point for LibFuzzer.
|
| extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
| // Media pipeline starts new threads, which needs AtExitManager.
|
| @@ -21,6 +39,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
|
| media::PipelineIntegrationTestBase test;
|
|
|
| + test.set_encrypted_media_init_data_cb(
|
| + base::Bind(&OnEncryptedMediaInitData, &test));
|
| +
|
| media::PipelineStatus pipeline_status =
|
| test.Start(data, size, media::PipelineIntegrationTestBase::kClockless);
|
| if (pipeline_status != media::PIPELINE_OK)
|
|
|