Native fault in MediaDrm property call
OEMCrypto was being initialized on session creation. Calls to get property information may occur before any sessions are created. This resulted in calls to OEMCrypto before a call to OEMCrypto_Initialize which caused a segfault. OEMCrypto initialization is now verified before any other calls are made. Unit tests have been modified to verify that this indeed works. bug: 8660973 Change-Id: I1b14fa8ad2e88750776b28715a48d8a1d1c57089
This commit is contained in:
@@ -179,6 +179,9 @@ bool CryptoEngine::GetToken(std::string* token) {
|
||||
}
|
||||
|
||||
CryptoEngine::SecurityLevel CryptoEngine::GetSecurityLevel() {
|
||||
if (!Init())
|
||||
return kSecurityLevelUnknown;
|
||||
|
||||
std::string security_level = OEMCrypto_SecurityLevel();
|
||||
|
||||
if ((security_level.size() != 2) ||
|
||||
@@ -197,6 +200,9 @@ CryptoEngine::SecurityLevel CryptoEngine::GetSecurityLevel() {
|
||||
}
|
||||
|
||||
bool CryptoEngine::GetDeviceUniqueId(std::string* deviceId) {
|
||||
if (!Init())
|
||||
return false;
|
||||
|
||||
std::vector<uint8_t> id;
|
||||
size_t idLength = 32;
|
||||
|
||||
@@ -213,6 +219,9 @@ bool CryptoEngine::GetDeviceUniqueId(std::string* deviceId) {
|
||||
}
|
||||
|
||||
bool CryptoEngine::GetSystemId(uint32_t* systemId) {
|
||||
if (!Init())
|
||||
return false;
|
||||
|
||||
uint8_t buf[72];
|
||||
size_t buflen = 72;
|
||||
|
||||
|
||||
@@ -200,10 +200,6 @@ TEST_F(WvCdmRequestLicenseTest, QueryKeyStatus) {
|
||||
}
|
||||
|
||||
TEST_F(WvCdmRequestLicenseTest, QueryStatus) {
|
||||
decryptor_.OpenSession(g_key_system, &session_id_);
|
||||
GenerateKeyRequest(g_key_system, g_key_id);
|
||||
VerifyKeyRequestResponse(g_license_server, g_client_auth, g_key_id, false);
|
||||
|
||||
CdmQueryMap query_info;
|
||||
CdmQueryMap::iterator itr;
|
||||
EXPECT_EQ(wvcdm::NO_ERROR, decryptor_.QueryStatus(&query_info));
|
||||
|
||||
Reference in New Issue
Block a user