summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/include
diff options
context:
space:
mode:
authorPawin Vongmasa <pawin@google.com>2016-06-21 19:10:21 -0700
committerZach Jang <zachjang@google.com>2016-07-20 16:17:37 -0700
commit030001de8b26291b139a8c1d594f05130dafac1b (patch)
tree2014d7a1bdd8c6188a58e4de3594c448ade42945 /media/libstagefright/include
parent1f24c730ab6ca5aff1e3137b340b8aeaeda4bdbc (diff)
downloadframeworks_av-030001de8b26291b139a8c1d594f05130dafac1b.zip
frameworks_av-030001de8b26291b139a8c1d594f05130dafac1b.tar.gz
frameworks_av-030001de8b26291b139a8c1d594f05130dafac1b.tar.bz2
Impose a size bound for dynamically allocated tables in stbl.
Impose a restriction of 200MiB for tables in stsc, stts, ctts and stss boxes. Also change mTimeToSample from Vector to array. Bug: 29367429 Change-Id: I953bea9fe0590268cf27376740f582dc88563d42 Merge conflict resolution of ag/1170200 to mnc-mr2-release
Diffstat (limited to 'media/libstagefright/include')
-rw-r--r--media/libstagefright/include/SampleTable.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/media/libstagefright/include/SampleTable.h b/media/libstagefright/include/SampleTable.h
index 465f37c..552eef7 100644
--- a/media/libstagefright/include/SampleTable.h
+++ b/media/libstagefright/include/SampleTable.h
@@ -24,7 +24,6 @@
#include <media/stagefright/MediaErrors.h>
#include <utils/RefBase.h>
#include <utils/threads.h>
-#include <utils/Vector.h>
namespace android {
@@ -96,6 +95,9 @@ private:
static const uint32_t kSampleSizeType32;
static const uint32_t kSampleSizeTypeCompact;
+ // Limit the total size of all internal tables to 200MiB.
+ static const size_t kMaxTotalSize = 200 * (1 << 20);
+
sp<DataSource> mDataSource;
Mutex mLock;
@@ -113,7 +115,7 @@ private:
bool mHasTimeToSample;
uint32_t mTimeToSampleCount;
- Vector<uint32_t> mTimeToSample;
+ uint32_t* mTimeToSample;
struct SampleTimeEntry {
uint32_t mSampleIndex;
@@ -139,6 +141,9 @@ private:
};
SampleToChunkEntry *mSampleToChunkEntries;
+ // Approximate size of all tables combined.
+ uint64_t mTotalSize;
+
friend struct SampleIterator;
// normally we don't round