diff options
| author | 2012-11-19 14:36:43 -0800 | |
|---|---|---|
| committer | 2012-11-19 14:36:43 -0800 | |
| commit | 1d3612f11cb0a56062059dad4643657750c23aab (patch) | |
| tree | 4f2c94563ae8b48e482462e20d591c73aa4de376 /libs/gui/BufferQueue.cpp | |
| parent | f9730c3b9655c32fc7ea13159ac5ff2f90fda3f1 (diff) | |
| parent | 2a8c49eb5dd51b2e60c9a78bea00870867d91c03 (diff) | |
am 2a8c49eb: fix an out-of-bounds memory access
* commit '2a8c49eb5dd51b2e60c9a78bea00870867d91c03':
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; + } } } } |