Merge "Improve visibility of IMemory security risks"

This commit is contained in:
Ytai Ben-tsvi
2019-09-17 15:05:44 +00:00
committed by Android (Google) Code Review

View File

@@ -290,14 +290,14 @@ TEST_F(WVCryptoPluginTest, AttemptsToDecrypt) {
sp<android::IMemory> source = memDealer->allocate(kDataSize);
ASSERT_NE(source, nullptr);
pSrc = static_cast<uint8_t*>(
static_cast<void*>(source->pointer()));
static_cast<void*>(source->unsecurePointer()));
ASSERT_NE(pSrc, nullptr);
memcpy(pSrc, in, source->size());
sp<android::IMemory> destination = memDealer->allocate(kDataSize);
ASSERT_NE(destination, nullptr);
pDest = static_cast<uint8_t*>(
static_cast<void*>(destination->pointer()));
static_cast<void*>(destination->unsecurePointer()));
ASSERT_NE(pDest, nullptr);
uint8_t iv[5][KEY_IV_SIZE];
@@ -451,14 +451,14 @@ TEST_F(WVCryptoPluginTest, CommunicatesSecureBufferRequest) {
sp<android::IMemory> source = memDealer->allocate(kDataSize);
ASSERT_NE(source, nullptr);
pSrc = static_cast<uint8_t*>(
static_cast<void*>(source->pointer()));
static_cast<void*>(source->unsecurePointer()));
ASSERT_NE(pSrc, nullptr);
memcpy(pSrc, in, source->size());
sp<android::IMemory> destination = memDealer->allocate(kDataSize);
ASSERT_NE(destination, nullptr);
pDest = static_cast<uint8_t*>(
static_cast<void*>(destination->pointer()));
static_cast<void*>(destination->unsecurePointer()));
ASSERT_NE(pDest, nullptr);
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
@@ -565,14 +565,14 @@ TEST_F(WVCryptoPluginTest, SetsFlagsForMinimumSubsampleRuns) {
sp<android::IMemory> source = memDealer->allocate(kDataSize);
ASSERT_NE(source, nullptr);
pSrc = static_cast<uint8_t*>(
static_cast<void*>(source->pointer()));
static_cast<void*>(source->unsecurePointer()));
ASSERT_NE(pSrc, nullptr);
memcpy(pSrc, in, source->size());
sp<android::IMemory> destination = memDealer->allocate(kDataSize);
ASSERT_NE(destination, nullptr);
pDest = static_cast<uint8_t*>(
static_cast<void*>(destination->pointer()));
static_cast<void*>(destination->unsecurePointer()));
ASSERT_NE(pDest, nullptr);
WVCryptoPlugin plugin(sessionId, kSessionIdSize, cdm.get());
@@ -678,14 +678,14 @@ TEST_F(WVCryptoPluginTest, AllowsSessionIdChanges) {
sp<android::IMemory> source = memDealer->allocate(kDataSize);
ASSERT_NE(source, nullptr);
pSrc = static_cast<uint8_t*>(
static_cast<void*>(source->pointer()));
static_cast<void*>(source->unsecurePointer()));
ASSERT_NE(pSrc, nullptr);
memcpy(pSrc, in, source->size());
sp<android::IMemory> destination = memDealer->allocate(kDataSize);
ASSERT_NE(destination, nullptr);
pDest = static_cast<uint8_t*>(
static_cast<void*>(destination->pointer()));
static_cast<void*>(destination->unsecurePointer()));
ASSERT_NE(pDest, nullptr);
uint8_t blank[1]; // Some compilers will not accept 0.