MPEG4Extractor: check the default sample info before checking the validity of sample size.
Test: atest MediaPlayerDrmTest
Bug: 135215092, Bug: 124525515
Change-Id: I6383514acaf546734b320224342a61cbd362c4bf
diff --git a/media/extractors/mp4/MPEG4Extractor.cpp b/media/extractors/mp4/MPEG4Extractor.cpp
index 5d693a1..cb845c4 100755
--- a/media/extractors/mp4/MPEG4Extractor.cpp
+++ b/media/extractors/mp4/MPEG4Extractor.cpp
@@ -5053,15 +5053,15 @@
mCurrentSampleInfoCount = smplcnt;
offset += 4;
size -= 4;
+ if (mCurrentDefaultSampleInfoSize != 0) {
+ ALOGV("@@@@ using default sample info size of %d", mCurrentDefaultSampleInfoSize);
+ return OK;
+ }
if(smplcnt > size) {
ALOGW("b/124525515 - smplcnt(%u) > size(%ld)", (unsigned int)smplcnt, (unsigned long)size);
android_errorWriteLog(0x534e4554, "124525515");
return -EINVAL;
}
- if (mCurrentDefaultSampleInfoSize != 0) {
- ALOGV("@@@@ using default sample info size of %d", mCurrentDefaultSampleInfoSize);
- return OK;
- }
if (smplcnt > mCurrentSampleInfoAllocSize) {
uint8_t * newPtr = (uint8_t*) realloc(mCurrentSampleInfoSizes, smplcnt);
if (newPtr == NULL) {