diff options
author | Robert Shih <robertshih@google.com> | 2014-09-10 20:19:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-10 20:19:54 +0000 |
commit | 97d917bc1ccc958d8f1051de6a888de9a25dc6bd (patch) | |
tree | 72f3121ce893fd64854b773b5bf63b23755140bd /media | |
parent | 7a107b857e658ba11c0c1fd2325ac91a2c0569a2 (diff) | |
parent | ab0b3212e0c15132f2dab2beeb39c47d31bb1dab (diff) | |
download | frameworks_av-97d917bc1ccc958d8f1051de6a888de9a25dc6bd.zip frameworks_av-97d917bc1ccc958d8f1051de6a888de9a25dc6bd.tar.gz frameworks_av-97d917bc1ccc958d8f1051de6a888de9a25dc6bd.tar.bz2 |
am ab0b3212: am 9b51a37f: am cb5dc219: am 74abb1ae: am 482b18bb: am f106b199: SampleTable: check integer overflow during table alloc
* commit 'ab0b3212e0c15132f2dab2beeb39c47d31bb1dab':
SampleTable: check integer overflow during table alloc
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/SampleTable.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/media/libstagefright/SampleTable.cpp b/media/libstagefright/SampleTable.cpp index d9858d7..8dfa365 100644 --- a/media/libstagefright/SampleTable.cpp +++ b/media/libstagefright/SampleTable.cpp @@ -330,6 +330,10 @@ status_t SampleTable::setTimeToSampleParams( } mTimeToSampleCount = U32_AT(&header[4]); + uint64_t allocSize = mTimeToSampleCount * 2 * sizeof(uint32_t); + if (allocSize > SIZE_MAX) { + return ERROR_OUT_OF_RANGE; + } mTimeToSample = new uint32_t[mTimeToSampleCount * 2]; size_t size = sizeof(uint32_t) * mTimeToSampleCount * 2; @@ -372,6 +376,11 @@ status_t SampleTable::setCompositionTimeToSampleParams( } mNumCompositionTimeDeltaEntries = numEntries; + uint64_t allocSize = numEntries * 2 * sizeof(uint32_t); + if (allocSize > SIZE_MAX) { + return ERROR_OUT_OF_RANGE; + } + mCompositionTimeDeltaEntries = new uint32_t[2 * numEntries]; if (mDataSource->readAt( @@ -417,6 +426,11 @@ status_t SampleTable::setSyncSampleParams(off64_t data_offset, size_t data_size) ALOGV("Table of sync samples is empty or has only a single entry!"); } + uint64_t allocSize = mNumSyncSamples * sizeof(uint32_t); + if (allocSize > SIZE_MAX) { + return ERROR_OUT_OF_RANGE; + } + mSyncSamples = new uint32_t[mNumSyncSamples]; size_t size = mNumSyncSamples * sizeof(uint32_t); if (mDataSource->readAt(mSyncSampleOffset + 8, mSyncSamples, size) |