diff options
author | Marco Nelissen <marcone@google.com> | 2015-10-02 15:12:00 -0700 |
---|---|---|
committer | Marco Nelissen <marcone@google.com> | 2015-10-06 07:48:29 -0700 |
commit | 5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d (patch) | |
tree | 6ee149bea15ae8b0b8f279e510535efddc234fef | |
parent | 3737a3fa121796131ea5b782230e65dad9ccf90f (diff) | |
download | frameworks_av-5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d.zip frameworks_av-5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d.tar.gz frameworks_av-5d101298d8b0a78a1dc5bd26dbdada411f4ecd4d.tar.bz2 |
Check NAL size before use
Bug: 24441553
Bug: 24445122
Change-Id: Ib7f025769adbafd5a2cb64fae5562a0a565945c2
-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 92065d1..af6b8bd 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -3293,7 +3293,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(); @@ -3566,7 +3569,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(); |