Source release 19.2.0
This commit is contained in:
38
oemcrypto/test/fuzz_tests/oemcrypto_load_release_fuzz.cc
Normal file
38
oemcrypto/test/fuzz_tests/oemcrypto_load_release_fuzz.cc
Normal file
@@ -0,0 +1,38 @@
|
||||
// Copyright 2024 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine
|
||||
// License Agreement.
|
||||
|
||||
#include "FuzzedDataProvider.h"
|
||||
#include "oec_session_util.h"
|
||||
#include "oemcrypto_fuzz_helper.h"
|
||||
#include "oemcrypto_fuzz_structs.h"
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
wvoec::RedirectStdoutToFile();
|
||||
|
||||
// Copy input data to OEMCrypto_Release_Response_Fuzz and rest of message
|
||||
// into encrypted license_release_response.
|
||||
wvoec::OEMCrypto_Release_Response_Fuzz fuzzed_structure;
|
||||
if (size < sizeof(fuzzed_structure)) {
|
||||
return 0;
|
||||
}
|
||||
FuzzedDataProvider fuzzed_data(data, size);
|
||||
fuzzed_data.ConsumeData(&fuzzed_structure, sizeof(fuzzed_structure));
|
||||
const std::vector<uint8_t> release_response =
|
||||
fuzzed_data.ConsumeRemainingBytes<uint8_t>();
|
||||
|
||||
wvoec::OEMCryptoLicenseAPIFuzz license_api_fuzz;
|
||||
license_api_fuzz.Initialize();
|
||||
license_api_fuzz.LoadLicense();
|
||||
|
||||
// Call release response API using fuzzed data.
|
||||
wvoec::ReleaseRoundTrip release_messages(
|
||||
&license_api_fuzz.license_messages());
|
||||
release_messages.SignAndVerifyRequest();
|
||||
release_messages.InjectFuzzedResponseData(
|
||||
fuzzed_structure, release_response.data(), release_response.size());
|
||||
release_messages.LoadResponse();
|
||||
|
||||
license_api_fuzz.Terminate();
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user