diff options
author | Andreas Huber <andih@google.com> | 2011-07-19 16:05:50 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-07-19 16:05:50 -0700 |
commit | 80d9064a14b4172d18edd3a5a70e6c2459b59eb7 (patch) | |
tree | 271d6450ed2b787cd7b41b57055480178e22cd32 | |
parent | 7dde1c8ccce049378b8aa9e757b6f907040c8640 (diff) | |
download | frameworks_base-80d9064a14b4172d18edd3a5a70e6c2459b59eb7.zip frameworks_base-80d9064a14b4172d18edd3a5a70e6c2459b59eb7.tar.gz frameworks_base-80d9064a14b4172d18edd3a5a70e6c2459b59eb7.tar.bz2 |
Content found in the wild violated the MPEG4 systems specs
but other players apparently worked around it as well, so we do to.
Change-Id: I8269d2344b010d1d704028c8a9c05bddab53828d
related-to-bug: 5049979
-rw-r--r-- | media/libstagefright/ESDS.cpp | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/media/libstagefright/ESDS.cpp b/media/libstagefright/ESDS.cpp index b7c8e0c..1f7ee25 100644 --- a/media/libstagefright/ESDS.cpp +++ b/media/libstagefright/ESDS.cpp @@ -14,6 +14,10 @@ * limitations under the License. */ +//#define LOG_NDEBUG 0 +#define LOG_TAG "ESDS" +#include <utils/Log.h> + #include "include/ESDS.h" #include <string.h> @@ -87,6 +91,8 @@ status_t ESDS::skipDescriptorHeader( } while (more); + LOGV("tag=0x%02x data_size=%d", *tag, *data_size); + if (*data_size > size) { return ERROR_MALFORMED; } @@ -146,8 +152,20 @@ status_t ESDS::parseESDescriptor(size_t offset, size_t size) { if (OCRstreamFlag) { offset += 2; size -= 2; + + if ((offset >= size || mData[offset] != kTag_DecoderConfigDescriptor) + && offset - 2 < size + && mData[offset - 2] == kTag_DecoderConfigDescriptor) { + // Content found "in the wild" had OCRstreamFlag set but was + // missing OCR_ES_Id, the decoder config descriptor immediately + // followed instead. + offset -= 2; + size += 2; + + LOGW("Found malformed 'esds' atom, ignoring missing OCR_ES_Id."); + } } - + if (offset >= size) { return ERROR_MALFORMED; } |