Fix errors being hidden by Protobuf warning-disabling

(This is a merge of http://go/wvgerrit/140850.)

This patch fixes a number of minor issues in the codebase (mostly
instances of 0-as-nullptr, but also some member shadowing and a missing
override) that were being hidden by the fact that depending on Protobuf
disables these diagnostics. And which will be unhidden when a later
patch removes that behavior from Protobuf.

Bug: 208304830
Test: x86-64
Change-Id: I4b0b1264748880b3726a6388d589868d898f949e
This commit is contained in:
John "Juce" Bruce
2021-12-15 10:34:31 -08:00
committed by John Bruce
parent 5606e7dae3
commit df23c7da03
5 changed files with 12 additions and 9 deletions

View File

@@ -95,7 +95,7 @@ void KeyDeriver::DeriveKey(const uint8_t* key, const vector<uint8_t>& context,
CMAC_CTX* cmac_ctx = CMAC_CTX_new();
ASSERT_NE(nullptr, cmac_ctx);
ASSERT_TRUE(CMAC_Init(cmac_ctx, key, KEY_SIZE, cipher, 0));
ASSERT_TRUE(CMAC_Init(cmac_ctx, key, KEY_SIZE, cipher, nullptr));
std::vector<uint8_t> message;
message.push_back(static_cast<uint8_t>(counter));

View File

@@ -1273,7 +1273,7 @@ Session::Session()
forced_session_id_(false),
session_id_(0),
nonce_(0),
public_rsa_(0) {}
public_rsa_(nullptr) {}
Session::~Session() {
if (!forced_session_id_ && open_) close();
@@ -1470,7 +1470,7 @@ void Session::LoadOEMCert(bool verify_cert) {
reinterpret_cast<const unsigned char*>(public_cert.data());
long cert_size = static_cast<long>(public_cert.size());
boringssl_ptr<PKCS7, PKCS7_free> pkcs7(
d2i_PKCS7(NULL, &cert_data, cert_size));
d2i_PKCS7(nullptr, &cert_data, cert_size));
ASSERT_TRUE(pkcs7.NotNull()) << "Error parsing PKCS7 message";
ASSERT_TRUE(PKCS7_type_is_signed(pkcs7.get()))
<< "Unexpected PKCS7 message type";