am c208cdd4: am 1d3612f1: am 2a8c49eb: fix an out-of-bounds memory access
* commit 'c208cdd402d767228a34074d589c6368cc656b7d':
fix an out-of-bounds memory access
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 590946a..607e0bd 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -314,10 +314,12 @@
* the consumer may still have pending reads of the
* buffers in flight.
*/
- bool isOlder = mSlots[i].mFrameNumber <
- mSlots[found].mFrameNumber;
- if (found < 0 || isOlder) {
- found = i;
+ if (found >= 0) {
+ bool isOlder = mSlots[i].mFrameNumber <
+ mSlots[found].mFrameNumber;
+ if (isOlder) {
+ found = i;
+ }
}
}
}