diff options
author | Marco Nelissen <marcone@google.com> | 2015-10-06 16:34:45 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-10-06 16:34:45 +0000 |
commit | 74d1927e4122a1748f89ca2ef79406fc06ee94b2 (patch) | |
tree | 8d2c582f35035464af6a68c0d7be5657e391cd39 | |
parent | 9ab9c85e39f089f355faa9cd9db6d113dc482e61 (diff) | |
parent | 5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d (diff) | |
download | frameworks_av-74d1927e4122a1748f89ca2ef79406fc06ee94b2.zip frameworks_av-74d1927e4122a1748f89ca2ef79406fc06ee94b2.tar.gz frameworks_av-74d1927e4122a1748f89ca2ef79406fc06ee94b2.tar.bz2 |
Merge "Check NAL size before use" into klp-dev
-rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index 990aa54..72e5e3b 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -3299,7 +3299,10 @@ status_t MPEG4Source::read( (const uint8_t *)mBuffer->data() + mBuffer->range_offset(); size_t nal_size = parseNALSize(src); - if (mBuffer->range_length() < mNALLengthSize + nal_size) { + if (mNALLengthSize > SIZE_MAX - nal_size) { + ALOGE("b/24441553, b/24445122"); + } + if (mBuffer->range_length() - mNALLengthSize < nal_size) { ALOGE("incomplete NAL unit."); mBuffer->release(); @@ -3572,7 +3575,11 @@ status_t MPEG4Source::fragmentedRead( (const uint8_t *)mBuffer->data() + mBuffer->range_offset(); size_t nal_size = parseNALSize(src); - if (mBuffer->range_length() < mNALLengthSize + nal_size) { + if (mNALLengthSize > SIZE_MAX - nal_size) { + ALOGE("b/24441553, b/24445122"); + } + + if (mBuffer->range_length() - mNALLengthSize < nal_size) { ALOGE("incomplete NAL unit."); mBuffer->release(); |