Skip to content

Commit 2c87d9b

Browse files
Wei Jiaandi34
authored andcommitted
DO NOT MERGE MPEG4Extractor: ensure kKeyTrackID exists before creating an MPEG4Source as track.
GenericSource: return error when no track exists. SampleIterator: make sure mSamplesPerChunk is not zero before using it as divisor. Bug: 21657957 Bug: 23705695 Bug: 22802344 Bug: 28799341 Change-Id: I7664992ade90b935d3f255dcd43ecc2898f30b04 (cherry picked from commit 0386c91) (cherry picked from commit b016207)
1 parent 411bf4c commit 2c87d9b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

media/libstagefright/MPEG4Extractor.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -883,6 +883,11 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
883883
}
884884

885885
if (isTrack) {
886+
int32_t trackId;
887+
// There must be exact one track header per track.
888+
if (!mLastTrack->meta->findInt32(kKeyTrackID, &trackId)) {
889+
mLastTrack->skipTrack = true;
890+
}
886891
if (mLastTrack->skipTrack) {
887892
Track *cur = mFirstTrack;
888893

media/libstagefright/SampleIterator.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,11 @@ status_t SampleIterator::seekTo(uint32_t sampleIndex) {
8484

8585
CHECK(sampleIndex < mStopChunkSampleIndex);
8686

87+
if (mSamplesPerChunk == 0) {
88+
ALOGE("b/22802344");
89+
return ERROR_MALFORMED;
90+
}
91+
8792
uint32_t chunk =
8893
(sampleIndex - mFirstChunkSampleIndex) / mSamplesPerChunk
8994
+ mFirstChunk;

0 commit comments

Comments
 (0)