Enabled log formatting warnings.
[ Merge of http://go/wvgerrit/105025 ] Clang and GCC allow for warnings against the arguments for printf-like functions (e.i. LOGx). These validate that the format type specified in the format string match the corresponding argument type. Most of the time, format specifer errors are benign; hence why they haven't been seen as an error so far. However, with the enabling of specifier warnings and the enabling of warnings as errors on certain platforms, these existing errors need to be addressed. This CL enables format specifier warnings for most of the Widevine code, with the OEMCrypto L3 implementation which has a single error which requires a fix in the haystack code before being fixed in the Widevine branch. Strict format string warnings are not enabled for non-LP64 systems. Bug: 137583127 Test: Compiled for Linux and Android Change-Id: I051398332d31a20457b86563a90ad8f6d428445f
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
#include "wv_cdm_constants.h"
|
||||
|
||||
namespace {
|
||||
|
||||
const uint32_t kFourCcCbc1 = 0x63626331;
|
||||
const uint32_t kFourCcCbcs = 0x63626373;
|
||||
const uint32_t kFourCcLittleEndianCbc1 = 0x31636263;
|
||||
@@ -32,10 +31,11 @@ const uint32_t kFourCcCenc = 0x63656e63;
|
||||
|
||||
const std::string kEmptyString;
|
||||
|
||||
// MAC key in the license are two separate MAC keys (client and server).
|
||||
constexpr size_t kLicenseMacKeySize = wvcdm::MAC_KEY_SIZE * 2;
|
||||
} // namespace
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
// Protobuf generated classes.
|
||||
using video_widevine::EncryptedClientIdentification;
|
||||
using video_widevine::License;
|
||||
@@ -596,17 +596,17 @@ CdmResponseType CdmLicense::HandleKeyResponse(
|
||||
mac_key_iv.assign(license.key(i).iv());
|
||||
|
||||
// Strip off PKCS#5 padding
|
||||
mac_keys.assign(license.key(i).key().data(), 2 * MAC_KEY_SIZE);
|
||||
mac_keys.assign(license.key(i).key().data(), kLicenseMacKeySize);
|
||||
}
|
||||
}
|
||||
if (license.policy().can_renew() ||
|
||||
(mac_key_iv.size() != 0 || mac_keys.size() != 0)) {
|
||||
if (mac_key_iv.size() != KEY_IV_SIZE ||
|
||||
mac_keys.size() != 2 * MAC_KEY_SIZE) {
|
||||
mac_keys.size() != kLicenseMacKeySize) {
|
||||
LOGE(
|
||||
"MAC key/IV size error: expected = %lu/%lu, "
|
||||
"MAC key/IV size error: expected = %zu/%zu, "
|
||||
"actual = %zu/%zu (key/iv)",
|
||||
2 * MAC_KEY_SIZE, KEY_IV_SIZE, mac_keys.size(), mac_key_iv.size());
|
||||
kLicenseMacKeySize, KEY_IV_SIZE, mac_keys.size(), mac_key_iv.size());
|
||||
return KEY_SIZE_ERROR_1;
|
||||
}
|
||||
}
|
||||
@@ -1177,7 +1177,7 @@ CdmResponseType CdmLicense::HandleNewEntitledKeys(
|
||||
if (content_key.size() < CONTENT_KEY_SIZE) {
|
||||
LOGE(
|
||||
"Entitled content key too small: "
|
||||
"expected = %lu, actual = %zu (bytes)",
|
||||
"expected = %zu, actual = %zu (bytes)",
|
||||
CONTENT_KEY_SIZE, content_key.size());
|
||||
return KEY_SIZE_ERROR_2;
|
||||
} else if (content_key.size() > CONTENT_KEY_SIZE) {
|
||||
|
||||
@@ -507,10 +507,10 @@ class WatchDog {
|
||||
ssize_t size = sizeof(flag);
|
||||
ssize_t size_written = file->Write(reinterpret_cast<char*>(&flag), size);
|
||||
if (size != size_written) {
|
||||
LOGE("Wrote %d bytes, not %d, to file %s", size_written, size,
|
||||
LOGE("Wrote %zd bytes, not %zd, to file %s", size_written, size,
|
||||
filename.c_str());
|
||||
} else {
|
||||
LOGE("I wrote %d to %s", size_written, filename.c_str());
|
||||
LOGE("I wrote %zd to %s", size_written, filename.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1055,7 +1055,7 @@ bool UsageTableHeader::LruUpgradeAllUsageEntries() {
|
||||
bad_license_file_entries.push_back(usage_entry_number);
|
||||
continue;
|
||||
default: {
|
||||
LOGW("Unknown usage entry storage type: %d, usage_entry_number = %u",
|
||||
LOGW("Unknown usage entry storage type: %d, usage_entry_number = %zu",
|
||||
static_cast<int>(usage_entry_info.storage_type),
|
||||
usage_entry_number);
|
||||
bad_license_file_entries.push_back(usage_entry_number);
|
||||
@@ -1063,7 +1063,7 @@ bool UsageTableHeader::LruUpgradeAllUsageEntries() {
|
||||
}
|
||||
}
|
||||
if (!retrieve_response) {
|
||||
LOGW("Could not retrieve license message: usage_entry_number = %u",
|
||||
LOGW("Could not retrieve license message: usage_entry_number = %zu",
|
||||
usage_entry_number);
|
||||
bad_license_file_entries.push_back(usage_entry_number);
|
||||
continue;
|
||||
@@ -1071,7 +1071,7 @@ bool UsageTableHeader::LruUpgradeAllUsageEntries() {
|
||||
|
||||
if (retrieved_entry_number != usage_entry_number) {
|
||||
LOGW(
|
||||
"Usage entry number mismatched: usage_entry_number = %u, "
|
||||
"Usage entry number mismatched: usage_entry_number = %zu, "
|
||||
"retrieved_entry_number = %u",
|
||||
usage_entry_number, retrieved_entry_number);
|
||||
bad_license_file_entries.push_back(usage_entry_number);
|
||||
@@ -1080,7 +1080,7 @@ bool UsageTableHeader::LruUpgradeAllUsageEntries() {
|
||||
|
||||
video_widevine::License license;
|
||||
if (!ParseLicenseFromLicenseMessage(license_message, &license)) {
|
||||
LOGW("Could not parse license: usage_entry_number = %u",
|
||||
LOGW("Could not parse license: usage_entry_number = %zu",
|
||||
usage_entry_number);
|
||||
bad_license_file_entries.push_back(usage_entry_number);
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user