diff options
author | Glenn Kasten <gkasten@google.com> | 2011-02-24 08:17:02 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-02-24 08:17:02 -0800 |
commit | 7b76c8d3fc25aedea6edfed9638b008faa2f6ae8 (patch) | |
tree | 5b95ab933413594616de072b5e4449eea5a4929d /media | |
parent | 256d603d11a6ecc15550593ff13fb555c2542ca8 (diff) | |
parent | df0b651236f9f44cdc70e209455e330fe31fc546 (diff) | |
download | frameworks_base-7b76c8d3fc25aedea6edfed9638b008faa2f6ae8.zip frameworks_base-7b76c8d3fc25aedea6edfed9638b008faa2f6ae8.tar.gz frameworks_base-7b76c8d3fc25aedea6edfed9638b008faa2f6ae8.tar.bz2 |
Merge "Don't crash when parsing DRM MIME types"
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/MediaExtractor.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/media/libstagefright/MediaExtractor.cpp b/media/libstagefright/MediaExtractor.cpp index dbd0829..d4651c4 100644 --- a/media/libstagefright/MediaExtractor.cpp +++ b/media/libstagefright/MediaExtractor.cpp @@ -67,12 +67,19 @@ sp<MediaExtractor> MediaExtractor::Create( mime, confidence); } - if (!strncmp(mime, "drm", 3)) { - const char *originalMime = strrchr(mime, '+') + 1; - - if (!strncmp(mime, "drm+es_based", 12)) { + // DRM MIME type syntax is "drm+type+original" where + // type is "es_based" or "container_based" and + // original is the content's cleartext MIME type + if (!strncmp(mime, "drm+", 4)) { + const char *originalMime = strchr(mime+4, '+'); + if (originalMime == NULL) { + // second + not found + return NULL; + } + ++originalMime; + if (!strncmp(mime, "drm+es_based+", 13)) { return new DRMExtractor(source, originalMime); - } else if (!strncmp(mime, "drm+container_based", 19)) { + } else if (!strncmp(mime, "drm+container_based+", 20)) { mime = originalMime; } else { return NULL; |