diff options
| author | 2012-11-19 15:14:08 -0800 | |
|---|---|---|
| committer | 2012-11-19 15:14:08 -0800 | |
| commit | c208cdd402d767228a34074d589c6368cc656b7d (patch) | |
| tree | 83ba21c411975e55e910c25ecf9f3a382757e88a /libs/gui/BufferQueue.cpp | |
| parent | 35d3988616cc40c0975d82f166c641109b787a58 (diff) | |
| parent | 1d3612f11cb0a56062059dad4643657750c23aab (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.cpp | 10 |
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; + } } } } |