diff options
author | Chong Zhang <chz@google.com> | 2015-08-18 16:55:38 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-08-18 16:55:38 +0000 |
commit | 877c76ac42701859fb8185f05c4724a06867fc07 (patch) | |
tree | 01b5c74709088c02ad0be92c595c948dde5eb988 | |
parent | f97b6beeb2e2f0977d1c7fa8d2aaafe4e2f4d68a (diff) | |
parent | 8ec845c8fe0f03bc57c901bc484541bdd6a7cf80 (diff) | |
download | frameworks_av-877c76ac42701859fb8185f05c4724a06867fc07.zip frameworks_av-877c76ac42701859fb8185f05c4724a06867fc07.tar.gz frameworks_av-877c76ac42701859fb8185f05c4724a06867fc07.tar.bz2 |
Merge "stagefright: check IMemory::pointer() before using the allocation" into klp-dev
-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 9fda07f..718e6c7 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -499,7 +499,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; @@ -756,7 +758,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 |