summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-04-22 13:21:03 -0700
committerJames Dong <jdong@google.com>2011-04-22 13:21:49 -0700
commit34d76acc4edb359a8639ddb6ce537b5156deb760 (patch)
tree682a69aedfc6f0c12b077de0b8fa115c56e91cd1 /media
parente528398fb65affca96e971ea9271b1ac16bf344c (diff)
downloadframeworks_base-34d76acc4edb359a8639ddb6ce537b5156deb760.zip
frameworks_base-34d76acc4edb359a8639ddb6ce537b5156deb760.tar.gz
frameworks_base-34d76acc4edb359a8639ddb6ce537b5156deb760.tar.bz2
Remove the assertion and report content malform error to application
Change-Id: I8e30c586048d38334fd4366959a124a99d8efe28 related-to-bug: 4267147
Diffstat (limited to 'media')
-rw-r--r--media/libstagefright/MPEG4Extractor.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f9db1a1..01d0a92 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -2028,14 +2028,18 @@ status_t MPEG4Source::read(
size_t dstOffset = 0;
while (srcOffset < size) {
- CHECK(srcOffset + mNALLengthSize <= size);
- size_t nalLength = parseNALSize(&mSrcBuffer[srcOffset]);
- srcOffset += mNALLengthSize;
+ bool isMalFormed = (srcOffset + mNALLengthSize > size);
+ size_t nalLength = 0;
+ if (!isMalFormed) {
+ nalLength = parseNALSize(&mSrcBuffer[srcOffset]);
+ srcOffset += mNALLengthSize;
+ isMalFormed = srcOffset + nalLength > size;
+ }
- if (srcOffset + nalLength > size) {
+ if (isMalFormed) {
+ LOGE("Video is malformed");
mBuffer->release();
mBuffer = NULL;
-
return ERROR_MALFORMED;
}