diff options
author | Chong Zhang <chz@google.com> | 2015-05-15 13:40:15 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-08-17 11:02:09 -0700 |
commit | 8ec845c8fe0f03bc57c901bc484541bdd6a7cf80 (patch) | |
tree | 4e12649c0f396e454cc55e630c52ed3e05c8f52c | |
parent | 3ce293842fed1b3abd2ff0aecd2a0c70a55086ee (diff) | |
download | frameworks_av-8ec845c8fe0f03bc57c901bc484541bdd6a7cf80.zip frameworks_av-8ec845c8fe0f03bc57c901bc484541bdd6a7cf80.tar.gz frameworks_av-8ec845c8fe0f03bc57c901bc484541bdd6a7cf80.tar.bz2 |
stagefright: check IMemory::pointer() before using the allocation
bug: 19779574
Change-Id: I4ffe8c3fadc07da211f421e75ee83010b01d9cbb
-rw-r--r-- | media/libstagefright/ACodec.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 9276818..2c9af32 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -498,7 +498,9 @@ status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) { for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) { sp<IMemory> mem = mDealer[portIndex]->allocate(def.nBufferSize); - CHECK(mem.get() != NULL); + if (mem == NULL || mem->pointer() == NULL) { + return NO_MEMORY; + } BufferInfo info; info.mStatus = BufferInfo::OWNED_BY_US; @@ -755,7 +757,9 @@ status_t ACodec::allocateOutputMetaDataBuffers() { sp<IMemory> mem = mDealer[kPortIndexOutput]->allocate( sizeof(struct VideoDecoderOutputMetaData)); - CHECK(mem.get() != NULL); + if (mem == NULL || mem->pointer() == NULL) { + return NO_MEMORY; + } info.mData = new ABuffer(mem->pointer(), mem->size()); // we use useBuffer for metadata regardless of quirks |