Merged from go/wvgerrit/178231 Bug: 290252845 Test: WVTS tests seem to be running and passing Change-Id: Ifff9123a73e173e835a6e89ba7c2760e1cd500fd (cherry picked from commit 6889845d2e7e24f22c00b333335c34259b3fc96e)
28 lines
1.0 KiB
C++
28 lines
1.0 KiB
C++
// Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine
|
|
// License Agreement.
|
|
|
|
#include <vector>
|
|
|
|
#include "oemcrypto_fuzz_helper.h"
|
|
#include "oemcrypto_fuzz_structs.h"
|
|
|
|
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|
wvoec::RedirectStdoutToFile();
|
|
|
|
// Reject the input if it is less than fuzz data structure size.
|
|
if (size < sizeof(wvoec::OEMCrypto_Request_Fuzz)) {
|
|
return 0;
|
|
}
|
|
// Input for license request API will be modified by OEMCrypto, hence it
|
|
// cannot be a const. Fuzzer complains if const identifier is removed of data,
|
|
// hence copying data into a non const pointer.
|
|
std::vector<uint8_t> input(data, data + size);
|
|
wvoec::OEMCryptoLicenseAPIFuzz license_api_fuzz;
|
|
license_api_fuzz.Initialize();
|
|
license_api_fuzz.license_messages().InjectFuzzedRequestData(input.data(),
|
|
input.size());
|
|
license_api_fuzz.Terminate();
|
|
return 0;
|
|
}
|