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

Commit 2a8c49eb authored by Mathias Agopian's avatar Mathias Agopian
Browse files

fix an out-of-bounds memory access

in this particular case, this OOB is always harmless
(and that's why it didn't get fixed from MR1), however,
it interfers with valgrind debugging.

Change-Id: Ic977e03287e59c4b124a89146c9023bd0cb540a8
parent ee932d0a
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -314,13 +314,15 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>& outFence,
                     * the consumer may still have pending reads of the
                     * buffers in flight.
                     */
                    if (found >= 0) {
                        bool isOlder = mSlots[i].mFrameNumber <
                                mSlots[found].mFrameNumber;
                    if (found < 0 || isOlder) {
                        if (isOlder) {
                            found = i;
                        }
                    }
                }
            }

            // clients are not allowed to dequeue more than one buffer
            // if they didn't set a buffer count.