summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJoshua J. Drake <android-open-source@qoop.org>2015-04-08 23:53:10 -0500
committerNick Kralevich <nnk@google.com>2015-04-09 18:47:03 -0700
commit0e4e5a8c09c63548f2a00c77ab5038b7703384bc (patch)
tree1bbcd7c4631dd284467e4e1e45327e7392602a9f /media
parentae6965ae7664aaea489a8d58358035610075c9af (diff)
downloadframeworks_av-0e4e5a8c09c63548f2a00c77ab5038b7703384bc.zip
frameworks_av-0e4e5a8c09c63548f2a00c77ab5038b7703384bc.tar.gz
frameworks_av-0e4e5a8c09c63548f2a00c77ab5038b7703384bc.tar.bz2
Fix integer underflow in ESDS processing
Several arithmetic operations within parseESDescriptor could underflow, leading to an out-of-bounds read operation. Ensure that subtractions from 'size' do not cause it to wrap around. Bug: 20139950 (cherry picked from commit 07c0f59d6c48874982d2b5c713487612e5af465a) Change-Id: I377d21051e07ca654ea1f7037120429d3f71924a
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/ESDS.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libstagefright/ESDS.cpp b/media/libstagefright/ESDS.cpp
index 4a0c35c..c76bc4a 100644
--- a/media/libstagefright/ESDS.cpp
+++ b/media/libstagefright/ESDS.cpp
@@ -136,6 +136,8 @@ status_t ESDS::parseESDescriptor(size_t offset, size_t size) {
--size;
if (streamDependenceFlag) {
+ if (size < 2)
+ return ERROR_MALFORMED;
offset += 2;
size -= 2;
}
@@ -145,11 +147,15 @@ status_t ESDS::parseESDescriptor(size_t offset, size_t size) {
return ERROR_MALFORMED;
}
unsigned URLlength = mData[offset];
+ if (URLlength >= size)
+ return ERROR_MALFORMED;
offset += URLlength + 1;
size -= URLlength + 1;
}
if (OCRstreamFlag) {
+ if (size < 2)
+ return ERROR_MALFORMED;
offset += 2;
size -= 2;