summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorJon Larimer <jlarimer@google.com>2015-08-18 16:47:06 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-18 16:47:06 +0000
commit6f0b1b3e25eb2db2e8465f13268c297fa9070012 (patch)
tree96ee4c002f5d3a9c968dcb5d6baf1de91405b012 /media/libstagefright/MPEG4Extractor.cpp
parent8a83ce9cf5487921596161c31714ae1a5e8db6b7 (diff)
parent484ebc81263a627b5e24e65373ab0752996ca0c8 (diff)
downloadframeworks_av-6f0b1b3e25eb2db2e8465f13268c297fa9070012.zip
frameworks_av-6f0b1b3e25eb2db2e8465f13268c297fa9070012.tar.gz
frameworks_av-6f0b1b3e25eb2db2e8465f13268c297fa9070012.tar.bz2
am 484ebc81: am a1e462e5: am 0afecdeb: am aa1cc741: Merge "Check buffer size before using it" into klp-dev
* commit '484ebc81263a627b5e24e65373ab0752996ca0c8': Check buffer size before using it
Diffstat (limited to 'media/libstagefright/MPEG4Extractor.cpp')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index 32c1a6c..4b3b45a 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -3814,6 +3814,10 @@ status_t MPEG4Source::read(
CHECK(mBuffer == NULL);
return err;
}
+ if (size > mBuffer->size()) {
+ ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
+ return ERROR_BUFFER_TOO_SMALL;
+ }
}
if ((!mIsAVC && !mIsHEVC) || mWantsNALFragments) {
@@ -4074,6 +4078,10 @@ status_t MPEG4Source::fragmentedRead(
ALOGV("acquire_buffer returned %d", err);
return err;
}
+ if (size > mBuffer->size()) {
+ ALOGE("buffer too small: %zu > %zu", size, mBuffer->size());
+ return ERROR_BUFFER_TOO_SMALL;
+ }
}
const Sample *smpl = &mCurrentSamples[mCurrentSampleIndex];