Reset crypto session pointers on RemoveKeys.

[ Merge of http://go/wvgerrit/189590 ]
[ Cherry-pick of http://ag/26541307 ]

The CDM session shares its CryptoSession instance with a few additional
member objects (CdmLicense and PolicyEngine).  When the CDM session's
crypto session is reset, it must also reset the CdmLicense and
PolicyEngine otherwise, a potential stale pointer reference may occur.

Test: request_license_test on Oriole
Test: run_x86_64_tests
Bug: 311239278
Change-Id: Ie175513ae652dcd96e12e5e1def574a8a56d5863
This commit is contained in:
Alex Dale
2024-03-11 15:19:21 -07:00
parent 5c175ad151
commit b1fad7f4cb
11 changed files with 182 additions and 75 deletions

View File

@@ -3467,6 +3467,26 @@ TEST_F(WvCdmRequestLicenseTest, StreamingLicenseRenewalProhibited) {
decryptor_->CloseSession(session_id_);
}
TEST_F(WvCdmRequestLicenseTest, StreamingLicense_WithCallToRemoveKeys) {
Unprovision();
Provision();
decryptor_->OpenSession(config_.key_system(), nullptr, kDefaultCdmIdentifier,
nullptr, &session_id_);
GenerateKeyRequest(binary_key_id(), kLicenseTypeStreaming);
const std::string license_response =
GetKeyRequestResponse(config_.license_server(), config_.client_auth());
ASSERT_FALSE(license_response.empty());
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_->RemoveKeys(session_id_));
// Should fail gracefully.
EXPECT_NE(wvcdm::KEY_ADDED,
decryptor_->AddKey(session_id_, license_response, &key_set_id_));
decryptor_->CloseSession(session_id_);
}
TEST_F(WvCdmRequestLicenseTest, OfflineLicenseRenewal) {
Unprovision();
Provision();