From 343324e97cc37fe1456e34119f273c2555e9cc4b Mon Sep 17 00:00:00 2001 From: Ian Benz Date: Tue, 10 Oct 2023 00:47:12 +0000 Subject: [PATCH] Add missing #include to fix the OPK Linux build Merged from https://widevine-internal-review.googlesource.com/185856 Merged from https://widevine-internal-review.googlesource.com/185910 Change-Id: I51d7a0fed2475333f459030005e796c2055fecc7 --- .../oemcrypto/test/oemcrypto_corpus_generator_helper.cpp | 6 +++++- .../oemcrypto/test/oemcrypto_corpus_generator_helper.h | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.cpp b/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.cpp index 31b9bb52..6b603dcf 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.cpp +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.cpp @@ -1,12 +1,14 @@ /* 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 "oemcrypto_corpus_generator_helper.h" #include #include namespace wvoec { + bool g_generate_corpus; void AppendToFile(const std::string& file_name, const char* message, @@ -32,7 +34,7 @@ void AppendSeparator(const std::string& file_name) { std::string GetFileName(const char* directory) { std::string file_name(PATH_TO_CORPUS); file_name += directory; - file_name += "/"; + file_name += '/'; file_name += std::to_string(rand()); return file_name; } @@ -40,5 +42,7 @@ std::string GetFileName(const char* directory) { void SetGenerateCorpus(bool should_generate_corpus) { g_generate_corpus = should_generate_corpus; } + bool ShouldGenerateCorpus() { return g_generate_corpus; } + } // namespace wvoec diff --git a/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.h b/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.h index e3a73b43..005dadef 100644 --- a/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.h +++ b/libwvdrmengine/oemcrypto/test/oemcrypto_corpus_generator_helper.h @@ -1,16 +1,18 @@ /* Copyright 2020 Google LLC. All rights reserved. This file and proprietary */ /* source code may only be used and distributed under the Widevine */ /* License Agreement. */ + #ifndef CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_ #define CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_ #define PATH_TO_CORPUS "./oemcrypto/test/fuzz_tests/corpus/" -#include +#include #include #include namespace wvoec { + const uint8_t kFuzzDataSeparator[] = {'-', '_', '^', '_'}; void AppendToFile(const std::string& file_name, const char* message, @@ -22,9 +24,11 @@ void AppendSeparator(const std::string& file_name); std::string GetFileName(const char* directory); void SetGenerateCorpus(bool should_generate_corpus); + // Output of this function decides if binary data needs to be written // to corpus files or not. Controlled by --generate_corpus flag. bool ShouldGenerateCorpus(); + } // namespace wvoec #endif // CDM_OEMCRYPTO_CORPUS_GENERATOR_HELPER_H_