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) {
|
||||
|
||||
Reference in New Issue
Block a user