diff options
| author | Wei Jia <wjia@google.com> | 2015-08-20 16:53:41 +0000 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-20 16:53:41 +0000 |
| commit | 2562495de9338e14ca3a3ef74ce07a7b310cd1fb (patch) | |
| tree | 81b550847bc49f1625eeb3f194f8efc65036bdb8 /media/libstagefright | |
| parent | 4b995f73b581ce0705b537317f32ad76bddb55fa (diff) | |
| parent | a590baca031199327f6382347625dd232de2c95c (diff) | |
| download | frameworks_av-2562495de9338e14ca3a3ef74ce07a7b310cd1fb.zip frameworks_av-2562495de9338e14ca3a3ef74ce07a7b310cd1fb.tar.gz frameworks_av-2562495de9338e14ca3a3ef74ce07a7b310cd1fb.tar.bz2 | |
am a590baca: Merge commit \'6ae815e0\' into HEAD
* commit 'a590baca031199327f6382347625dd232de2c95c':
libstagefright: fix overflow in MPEG4Source::parseSampleAuxiliaryInformationOffsets.
Diffstat (limited to 'media/libstagefright')
| -rw-r--r-- | media/libstagefright/MPEG4Extractor.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp index bbd351a..5cd3049 100644 --- a/media/libstagefright/MPEG4Extractor.cpp +++ b/media/libstagefright/MPEG4Extractor.cpp @@ -44,6 +44,10 @@ #include <byteswap.h> #include "include/ID3.h" +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + namespace android { class MPEG4Source : public MediaSource { @@ -3322,13 +3326,27 @@ status_t MPEG4Source::parseSampleAuxiliaryInformationOffsets( return ERROR_IO; } offset += 4; + if (entrycount == 0) { + return OK; + } + if (entrycount > UINT32_MAX / 8) { + return ERROR_MALFORMED; + } if (entrycount > mCurrentSampleInfoOffsetsAllocSize) { - mCurrentSampleInfoOffsets = (uint64_t*) realloc(mCurrentSampleInfoOffsets, entrycount * 8); + uint64_t *newPtr = (uint64_t *)realloc(mCurrentSampleInfoOffsets, entrycount * 8); + if (newPtr == NULL) { + return NO_MEMORY; + } + mCurrentSampleInfoOffsets = newPtr; mCurrentSampleInfoOffsetsAllocSize = entrycount; } mCurrentSampleInfoOffsetCount = entrycount; + if (mCurrentSampleInfoOffsets == NULL) { + return OK; + } + for (size_t i = 0; i < entrycount; i++) { if (version == 0) { uint32_t tmp; |
