summaryrefslogtreecommitdiff
path: root/libs/gui/BufferQueue.cpp
diff options
context:
space:
mode:
author Mathias Agopian <mathias@google.com> 2012-11-19 15:14:08 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2012-11-19 15:14:08 -0800
commitc208cdd402d767228a34074d589c6368cc656b7d (patch)
tree83ba21c411975e55e910c25ecf9f3a382757e88a /libs/gui/BufferQueue.cpp
parent35d3988616cc40c0975d82f166c641109b787a58 (diff)
parent1d3612f11cb0a56062059dad4643657750c23aab (diff)
am 1d3612f1: am 2a8c49eb: fix an out-of-bounds memory access
* commit '1d3612f11cb0a56062059dad4643657750c23aab': fix an out-of-bounds memory access
Diffstat (limited to 'libs/gui/BufferQueue.cpp')
-rw-r--r--libs/gui/BufferQueue.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/libs/gui/BufferQueue.cpp b/libs/gui/BufferQueue.cpp
index 590946a854..607e0bdbec 100644
--- a/libs/gui/BufferQueue.cpp
+++ b/libs/gui/BufferQueue.cpp
@@ -314,10 +314,12 @@ status_t BufferQueue::dequeueBuffer(int *outBuf, sp<Fence>& outFence,
* 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;
+ }
}
}
}