diff options
author | Robert Shih <robertshih@google.com> | 2014-09-10 20:26:40 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-10 20:26:40 +0000 |
commit | 0d83cf22991c48f4bb5f2afe3d16ae076861f394 (patch) | |
tree | 369504c26f6f15ef8cf0999c42734239a8ea7409 | |
parent | 01eed3c0fb951e349d68f4bce818bef22e7925b1 (diff) | |
parent | 97d917bc1ccc958d8f1051de6a888de9a25dc6bd (diff) | |
download | frameworks_av-0d83cf22991c48f4bb5f2afe3d16ae076861f394.zip frameworks_av-0d83cf22991c48f4bb5f2afe3d16ae076861f394.tar.gz frameworks_av-0d83cf22991c48f4bb5f2afe3d16ae076861f394.tar.bz2 |
am 97d917bc: am ab0b3212: am 9b51a37f: am cb5dc219: am 74abb1ae: am 482b18bb: am f106b199: SampleTable: check integer overflow during table alloc
* commit '97d917bc1ccc958d8f1051de6a888de9a25dc6bd':
SampleTable: check integer overflow during table alloc
-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) |