summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation/ALooperRoster.cpp
diff options
context:
space:
mode:
authorNick Kralevich <nnk@google.com>2015-06-13 17:03:06 -0700
committerNick Kralevich <nnk@google.com>2015-06-13 17:36:11 -0700
commit938e2b34b16c3c1fd29c753eeb53ee95a2b2e2b3 (patch)
tree6b1ab91af2925ec43021109dc8b514073f2ad482 /media/libstagefright/foundation/ALooperRoster.cpp
parent0907d87dca62cd5bc12d26892c411b7140d148b0 (diff)
downloadframeworks_av-938e2b34b16c3c1fd29c753eeb53ee95a2b2e2b3.zip
frameworks_av-938e2b34b16c3c1fd29c753eeb53ee95a2b2e2b3.tar.gz
frameworks_av-938e2b34b16c3c1fd29c753eeb53ee95a2b2e2b3.tar.bz2
don't trigger an integer underflow when decrementing.
When decrementing "i", eventually i will equal zero. When that happens, i-- underflows. This causes a crash when code which uses clang's -fsanitize=unsigned-integer-overflow is run. Avoid trigging an unsigned integer underflow. Change-Id: I61709cb01f56fdb36d631aa95579e8bd09cafd12
Diffstat (limited to 'media/libstagefright/foundation/ALooperRoster.cpp')
-rw-r--r--media/libstagefright/foundation/ALooperRoster.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libstagefright/foundation/ALooperRoster.cpp b/media/libstagefright/foundation/ALooperRoster.cpp
index 473ce1b..9ed53e7 100644
--- a/media/libstagefright/foundation/ALooperRoster.cpp
+++ b/media/libstagefright/foundation/ALooperRoster.cpp
@@ -79,7 +79,8 @@ void ALooperRoster::unregisterStaleHandlers() {
{
Mutex::Autolock autoLock(mLock);
- for (size_t i = mHandlers.size(); i-- > 0;) {
+ for (size_t i = mHandlers.size(); i > 0;) {
+ i--;
const HandlerInfo &info = mHandlers.valueAt(i);
sp<ALooper> looper = info.mLooper.promote();