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
This commit is contained in:
Mathias Agopian 2012-11-15 17:19:48 -08:00
parent ee932d0ad1
commit 2a8c49eb5d

View File

@ -314,10 +314,12 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>& outFence,
* the consumer may still have pending reads of the * the consumer may still have pending reads of the
* buffers in flight. * buffers in flight.
*/ */
bool isOlder = mSlots[i].mFrameNumber < if (found >= 0) {
mSlots[found].mFrameNumber; bool isOlder = mSlots[i].mFrameNumber <
if (found < 0 || isOlder) { mSlots[found].mFrameNumber;
found = i; if (isOlder) {
found = i;
}
} }
} }
} }