summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/VBRISeeker.cpp
diff options
context:
space:
mode:
authorWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 22:43:10 +0100
committerWolfgang Wiedmeyer <wolfgit@wiedmeyer.de>2017-02-11 22:43:10 +0100
commit26718276fd99ef60d9646d79467d2bb3f2db5549 (patch)
treefa47c708c4a931e0506f6ea5a212aa2a433c8b38 /media/libstagefright/VBRISeeker.cpp
parente9c0ba1859c0f5890fed280e03d0328311234cce (diff)
parentad990eb12c7aff3c4bcdd50cae90b2b7c20041e6 (diff)
downloadframeworks_av-26718276fd99ef60d9646d79467d2bb3f2db5549.zip
frameworks_av-26718276fd99ef60d9646d79467d2bb3f2db5549.tar.gz
frameworks_av-26718276fd99ef60d9646d79467d2bb3f2db5549.tar.bz2
Merge branch 'cm-13.0' of https://github.com/LineageOS/android_frameworks_av into replicant-6.0
Diffstat (limited to 'media/libstagefright/VBRISeeker.cpp')
-rw-r--r--media/libstagefright/VBRISeeker.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/media/libstagefright/VBRISeeker.cpp b/media/libstagefright/VBRISeeker.cpp
index 8a0fcac..5067ddc 100644
--- a/media/libstagefright/VBRISeeker.cpp
+++ b/media/libstagefright/VBRISeeker.cpp
@@ -83,8 +83,23 @@ sp<VBRISeeker> VBRISeeker::CreateFromSource(
scale,
entrySize);
+ if (entrySize > 4) {
+ ALOGE("invalid VBRI entry size: %zu", entrySize);
+ return NULL;
+ }
+
+ sp<VBRISeeker> seeker = new (std::nothrow) VBRISeeker;
+ if (seeker == NULL) {
+ ALOGW("Couldn't allocate VBRISeeker");
+ return NULL;
+ }
+
size_t totalEntrySize = numEntries * entrySize;
- uint8_t *buffer = new uint8_t[totalEntrySize];
+ uint8_t *buffer = new (std::nothrow) uint8_t[totalEntrySize];
+ if (!buffer) {
+ ALOGW("Couldn't allocate %zu bytes", totalEntrySize);
+ return NULL;
+ }
n = source->readAt(pos + sizeof(vbriHeader), buffer, totalEntrySize);
if (n < (ssize_t)totalEntrySize) {
@@ -94,7 +109,6 @@ sp<VBRISeeker> VBRISeeker::CreateFromSource(
return NULL;
}
- sp<VBRISeeker> seeker = new VBRISeeker;
seeker->mBasePos = post_id3_pos + frameSize;
// only update mDurationUs if the calculated duration is valid (non zero)
// otherwise, leave duration at -1 so that getDuration() and getOffsetForTime()