Address releaseAllSecureStops crash

[ Merge of http://go/wvgerrit/15474 ]

Changes to releaseAllSecureStops made use of a session that was
initialized only if getSecureStops had been previously called. If it was not,
accessing the session resulted in a segfault. This was uncovered by a change
in how the Netflix app invoked mediaDrm.

b/23498809

Change-Id: Ib426ae1830c3a42c5e0849f1b6e8bbfe0d2c74ff
This commit is contained in:
Rahul Frias
2015-08-25 10:40:12 -07:00
parent 6a7d526def
commit 25a6185c84

View File

@@ -804,6 +804,11 @@ CdmResponseType CdmEngine::GetUsageInfo(const std::string& app_id,
}
CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
if (NULL == usage_property_set_.get()) {
usage_property_set_.reset(new UsagePropertySet());
}
usage_property_set_->set_app_id(app_id);
CdmResponseType status = NO_ERROR;
for (int j = kSecurityLevelL1; j < kSecurityLevelUnknown; ++j) {
DeviceFiles handle;
@@ -814,6 +819,13 @@ CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
"stops", j);
status = RELEASE_ALL_USAGE_INFO_ERROR_1;
} else {
SecurityLevel security_level =
static_cast<CdmSecurityLevel>(j) == kSecurityLevelL3
? kLevel3
: kLevelDefault;
usage_property_set_->set_security_level(security_level);
usage_session_.reset(
new CdmSession(usage_property_set_.get(), EMPTY_ORIGIN, NULL));
CdmResponseType status2 = usage_session_->
DeleteMultipleUsageInformation(provider_session_tokens);
if (status2 != NO_ERROR) {
@@ -826,6 +838,7 @@ CdmResponseType CdmEngine::ReleaseAllUsageInfo(const std::string& app_id) {
status = RELEASE_ALL_USAGE_INFO_ERROR_2;
}
}
usage_session_.reset(NULL);
return status;
}