Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8ec845c8 authored by Chong Zhang's avatar Chong Zhang
Browse files

stagefright: check IMemory::pointer() before using the allocation

bug: 19779574
Change-Id: I4ffe8c3fadc07da211f421e75ee83010b01d9cbb
parent 3ce29384
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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