summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MediaCodecList.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/MediaCodecList.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/MediaCodecList.cpp')
-rw-r--r--media/libstagefright/MediaCodecList.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libstagefright/MediaCodecList.cpp b/media/libstagefright/MediaCodecList.cpp
index 3f10be6..a47bfc7 100644
--- a/media/libstagefright/MediaCodecList.cpp
+++ b/media/libstagefright/MediaCodecList.cpp
@@ -220,7 +220,8 @@ void MediaCodecList::parseTopLevelXMLFile(const char *codecs_xml, bool ignore_er
}
}
- for (size_t i = mCodecInfos.size(); i-- > 0;) {
+ for (size_t i = mCodecInfos.size(); i > 0;) {
+ i--;
const MediaCodecInfo &info = *mCodecInfos.itemAt(i).get();
if (info.mCaps.size() == 0) {
// No types supported by this component???