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

Commit 11b3066c authored by Pawin Vongmasa's avatar Pawin Vongmasa Committed by android-build-merger
Browse files

Merge "Check the buffer index from acquireBuffer" into mnc-dev am: ec2549aa

am: adfbbe16

Change-Id: I2c5cb01a4d8fbeaed1dbadc5cb1ab3b4a0f7d60e
parents f0221a7d adfbbe16
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -473,6 +473,12 @@ void GraphicBufferSource::suspend(bool suspend) {
            } else if (err != OK) {
                ALOGW("suspend: acquireBuffer returned err=%d", err);
                break;
            } else if (item.mBuf < 0 ||
                    item.mBuf >= BufferQueue::NUM_BUFFER_SLOTS) {
                // Invalid buffer index
                ALOGW("suspend: corrupted buffer index (%d)",
                        item.mBuf);
                break;
            }

            ++mNumBufferAcquired;
@@ -524,6 +530,10 @@ bool GraphicBufferSource::fillCodecBuffer_l() {
        // now what? fake end-of-stream?
        ALOGW("fillCodecBuffer_l: acquireBuffer returned err=%d", err);
        return false;
    } else if (item.mBuf < 0 || item.mBuf >= BufferQueue::NUM_BUFFER_SLOTS) {
        // Invalid buffer index
        ALOGW("fillCodecBuffer_l: corrupted buffer index (%d)", item.mBuf);
        return false;
    }

    mNumBufferAcquired++;
@@ -877,8 +887,14 @@ void GraphicBufferSource::onFrameAvailable(const BufferItem& /*item*/) {
        BufferItem item;
        status_t err = mConsumer->acquireBuffer(&item, 0);
        if (err == OK) {
            if (item.mBuf < 0 ||
                    item.mBuf >= BufferQueue::NUM_BUFFER_SLOTS) {
                // Invalid buffer index
                ALOGW("onFrameAvailable: corrupted buffer index (%d)",
                        item.mBuf);
                return;
            }
            mNumBufferAcquired++;

            // If this is the first time we're seeing this buffer, add it to our
            // slot table.
            if (item.mGraphicBuffer != NULL) {