This is a cherry pick of recent changes to OEMCrypto and ODK. Most of these are part of the document migration to doxygen. See http://go/wvgerrit/106005 and its parents for code reviews. Bug: 144715340 Bug: 148232693 Bug: 167580674 Change-Id: I658f99c8117b974faed97322d61fac0f382283af
26 lines
907 B
C++
26 lines
907 B
C++
// Copyright 2020 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine Master
|
|
// License Agreement.
|
|
#include "oemcrypto_fuzz_helper.h"
|
|
|
|
namespace wvoec {
|
|
void RedirectStdoutToFile() { freopen("log.txt", "a", stdout); }
|
|
|
|
std::vector<std::vector<uint8_t>> SplitInput(const uint8_t* data, size_t size) {
|
|
std::vector<std::vector<uint8_t>> result;
|
|
auto current_pos = data;
|
|
auto end = data + size;
|
|
// Using memmem to find separator
|
|
while (const uint8_t* pos = reinterpret_cast<const uint8_t*>(
|
|
memmem(current_pos, end - current_pos, kFuzzDataSeparator,
|
|
sizeof(kFuzzDataSeparator)))) {
|
|
result.push_back({current_pos, pos});
|
|
current_pos = pos + sizeof(kFuzzDataSeparator);
|
|
}
|
|
if (current_pos < end) {
|
|
result.push_back({current_pos, end});
|
|
}
|
|
return result;
|
|
}
|
|
} // namespace wvoec
|