[fuzzing] add oemcrypto_shrink_usage_table_header_fuzz
Merge from Widevine repo of http://go/wvgerrit/158860 Bug: b/243078947 Test: tested with http://go/ag/20420224 Change-Id: I00d7f96ad86990ed62fb1b81508bf79bbdd3da13
This commit is contained in:
committed by
Fred Gylys-Colwell
parent
0ad587ca20
commit
d9567c66fd
@@ -0,0 +1,28 @@
|
||||
// Copyright 2022 Google LLC. All Rights Reserved. This file and proprietary
|
||||
// source code may only be used and distributed under the Widevine
|
||||
// License Agreement.
|
||||
|
||||
#include "OEMCryptoCENC.h"
|
||||
#include "oemcrypto_fuzz_helper.h"
|
||||
|
||||
namespace wvoec {
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
// Redirect printf and log statements from oemcrypto functions to a file to
|
||||
// reduce noise
|
||||
RedirectStdoutToFile();
|
||||
|
||||
if (size < sizeof(uint32_t)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
LicenseWithUsageEntryFuzz entry;
|
||||
uint32_t new_entry_count = 0;
|
||||
memcpy(&new_entry_count, data, sizeof(uint32_t));
|
||||
std::vector<uint8_t> header_buffer(size - sizeof(uint32_t));
|
||||
size_t header_buffer_length = header_buffer.size();
|
||||
OEMCrypto_ShrinkUsageTableHeader(new_entry_count, header_buffer.data(),
|
||||
&header_buffer_length);
|
||||
|
||||
return 0;
|
||||
}
|
||||
} // namespace wvoec
|
||||
Reference in New Issue
Block a user