Files
ce_cdm/oemcrypto/test/fuzz_tests/oemcrypto_renewal_request_fuzz.cc
John "Juce" Bruce 2baa7c6e2b Source release 17.1.2
2023-06-23 15:37:42 -07:00

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();
// If input size is less than fuzz data structure, reject the input.
if (size < sizeof(wvoec::OEMCrypto_Request_Fuzz)) {
return 0;
}
// Input for renewal 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::OEMCryptoRenewalAPIFuzz renewal_api_fuzz;
renewal_api_fuzz.Initialize();
renewal_api_fuzz.renewal_messages().InjectFuzzedRequestData(input.data(),
input.size());
renewal_api_fuzz.Terminate();
return 0;
}