summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/MPEG4Extractor.cpp
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2015-07-01 13:05:50 -0700
committerAbhishek Arya <aarya@google.com>2015-08-15 03:59:05 +0000
commitf11e95b21007f24e5ab77298370855f9f085b2d7 (patch)
treeaefbe9c812eb3a65c4ad95ea202052ef97943ef7 /media/libstagefright/MPEG4Extractor.cpp
parent3ce293842fed1b3abd2ff0aecd2a0c70a55086ee (diff)
downloadframeworks_av-f11e95b21007f24e5ab77298370855f9f085b2d7.zip
frameworks_av-f11e95b21007f24e5ab77298370855f9f085b2d7.tar.gz
frameworks_av-f11e95b21007f24e5ab77298370855f9f085b2d7.tar.bz2
Check buffer size before using it
Bug: 21814993 Change-Id: Idaac61b4b9f4058b94e84093644593ba315d72ff (cherry picked from commit c1a104aaad2d84a57bf5d87dd030d2bef56bf541)
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 56bd875..46010ca 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -3193,6 +3193,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 || mWantsNALFragments) {
@@ -3439,6 +3443,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];