diff options
author | Joshua J. Drake <android-open-source@qoop.org> | 2015-04-08 23:53:10 -0500 |
---|---|---|
committer | Paul Kocialkowski <contact@paulk.fr> | 2015-08-31 00:22:02 +0200 |
commit | e3b0877212dacc0b3e65fce1d4ee4352e8ed9fb3 (patch) | |
tree | 592bdae7ead47fe6c6b702755b2215e09902dbf7 | |
parent | a27dee19653466844fd84d88a670daf7d0cc871a (diff) | |
download | frameworks_av-e3b0877212dacc0b3e65fce1d4ee4352e8ed9fb3.zip frameworks_av-e3b0877212dacc0b3e65fce1d4ee4352e8ed9fb3.tar.gz frameworks_av-e3b0877212dacc0b3e65fce1d4ee4352e8ed9fb3.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
Change-Id: Ie987c58e49323ff273fd57db410534fa83db1cb2
Signed-off-by: Joshua J. Drake <android-open-source@qoop.org>
Tested-by: Moritz Bandemer <replicant@posteo.mx>
-rw-r--r-- | media/libstagefright/ESDS.cpp | 6 |
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; |