summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/id3
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2010-03-29 15:13:40 -0700
committerAndreas Huber <andih@google.com>2010-03-29 15:13:40 -0700
commitc2eeb2f52ed907d9502981759e9f30c35cea683d (patch)
tree87a9439d8d0d1c3d109405e0117802e2bc0b8b6f /media/libstagefright/id3
parent272b504ee6aaf2515572520cd642f9a4fbf81a44 (diff)
downloadframeworks_base-c2eeb2f52ed907d9502981759e9f30c35cea683d.zip
frameworks_base-c2eeb2f52ed907d9502981759e9f30c35cea683d.tar.gz
frameworks_base-c2eeb2f52ed907d9502981759e9f30c35cea683d.tar.bz2
Limit the total amount of ID3 metadata to something (un-)reasonable: 3MB.
Change-Id: I3f9bbcdd4f563bac27c4ccae58e4179656c264b6 related-to-bug: 1903971
Diffstat (limited to 'media/libstagefright/id3')
-rw-r--r--media/libstagefright/id3/ID3.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/media/libstagefright/id3/ID3.cpp b/media/libstagefright/id3/ID3.cpp
index b263238..d688e2c 100644
--- a/media/libstagefright/id3/ID3.cpp
+++ b/media/libstagefright/id3/ID3.cpp
@@ -28,6 +28,8 @@
namespace android {
+static const size_t kMaxMetadataSize = 3 * 1024 * 1024;
+
ID3::ID3(const sp<DataSource> &source)
: mIsValid(false),
mData(NULL),
@@ -111,6 +113,11 @@ bool ID3::parseV2(const sp<DataSource> &source) {
size = (size << 7) | header.enc_size[i];
}
+ if (size > kMaxMetadataSize) {
+ LOGE("skipping huge ID3 metadata of size %d", size);
+ return false;
+ }
+
mData = (uint8_t *)malloc(size);
if (mData == NULL) {