зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1020679 - Guard against MP4 /0 for timescale. r=cpearce
This commit is contained in:
Родитель
60c42c6d30
Коммит
37a9aa9902
|
@ -88,8 +88,9 @@ MP4Demuxer::Init()
|
||||||
sp<MetaData> metaData = e->getTrackMetaData(i);
|
sp<MetaData> metaData = e->getTrackMetaData(i);
|
||||||
|
|
||||||
const char* mimeType;
|
const char* mimeType;
|
||||||
if (!metaData->findCString(kKeyMIMEType, &mimeType))
|
if (metaData == nullptr || !metaData->findCString(kKeyMIMEType, &mimeType)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!mPrivate->mAudio.get() && !strncmp(mimeType, "audio/", 6)) {
|
if (!mPrivate->mAudio.get() && !strncmp(mimeType, "audio/", 6)) {
|
||||||
mPrivate->mAudio = e->getTrack(i);
|
mPrivate->mAudio = e->getTrack(i);
|
||||||
|
|
|
@ -449,6 +449,9 @@ sp<MetaData> MPEG4Extractor::getTrackMetaData(
|
||||||
&& track->sampleTable->getMetaDataForSample(
|
&& track->sampleTable->getMetaDataForSample(
|
||||||
sampleIndex, NULL /* offset */, NULL /* size */,
|
sampleIndex, NULL /* offset */, NULL /* size */,
|
||||||
&sampleTime) == OK) {
|
&sampleTime) == OK) {
|
||||||
|
if (!track->timescale) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
track->meta->setInt64(
|
track->meta->setInt64(
|
||||||
kKeyThumbnailTime,
|
kKeyThumbnailTime,
|
||||||
((int64_t)sampleTime * 1000000) / track->timescale);
|
((int64_t)sampleTime * 1000000) / track->timescale);
|
||||||
|
@ -1137,6 +1140,9 @@ status_t MPEG4Extractor::parseChunk(off64_t *offset, int depth) {
|
||||||
duration = ntohl(duration32);
|
duration = ntohl(duration32);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!mLastTrack->timescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
mLastTrack->meta->setInt64(
|
mLastTrack->meta->setInt64(
|
||||||
kKeyDuration, (duration * 1000000) / mLastTrack->timescale);
|
kKeyDuration, (duration * 1000000) / mLastTrack->timescale);
|
||||||
|
|
||||||
|
@ -1807,6 +1813,9 @@ status_t MPEG4Extractor::parseSegmentIndex(off64_t offset, size_t size) {
|
||||||
if (!mDataSource->getUInt32(offset + 8, &timeScale)) {
|
if (!mDataSource->getUInt32(offset + 8, &timeScale)) {
|
||||||
return ERROR_MALFORMED;
|
return ERROR_MALFORMED;
|
||||||
}
|
}
|
||||||
|
if (!timeScale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
ALOGV("sidx refid/timescale: %d/%d", referenceId, timeScale);
|
ALOGV("sidx refid/timescale: %d/%d", referenceId, timeScale);
|
||||||
|
|
||||||
uint64_t earliestPresentationTime;
|
uint64_t earliestPresentationTime;
|
||||||
|
@ -3111,6 +3120,9 @@ status_t MPEG4Source::read(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == ReadOptions::SEEK_CLOSEST) {
|
if (mode == ReadOptions::SEEK_CLOSEST) {
|
||||||
|
if (!mTimescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
|
targetSampleTimeUs = (sampleTime * 1000000ll) / mTimescale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3177,6 +3189,9 @@ status_t MPEG4Source::read(
|
||||||
mBuffer->set_range(0, size);
|
mBuffer->set_range(0, size);
|
||||||
mBuffer->meta_data()->clear();
|
mBuffer->meta_data()->clear();
|
||||||
mBuffer->meta_data()->setInt64(kKey64BitFileOffset, offset);
|
mBuffer->meta_data()->setInt64(kKey64BitFileOffset, offset);
|
||||||
|
if (!mTimescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
|
@ -3302,6 +3317,9 @@ status_t MPEG4Source::read(
|
||||||
|
|
||||||
mBuffer->meta_data()->clear();
|
mBuffer->meta_data()->clear();
|
||||||
mBuffer->meta_data()->setInt64(kKey64BitFileOffset, offset);
|
mBuffer->meta_data()->setInt64(kKey64BitFileOffset, offset);
|
||||||
|
if (!mTimescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
|
@ -3457,6 +3475,9 @@ status_t MPEG4Source::fragmentedRead(
|
||||||
|
|
||||||
CHECK(mBuffer != NULL);
|
CHECK(mBuffer != NULL);
|
||||||
mBuffer->set_range(0, size);
|
mBuffer->set_range(0, size);
|
||||||
|
if (!mTimescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
|
@ -3582,6 +3603,9 @@ status_t MPEG4Source::fragmentedRead(
|
||||||
mBuffer->set_range(0, dstOffset);
|
mBuffer->set_range(0, dstOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!mTimescale) {
|
||||||
|
return ERROR_MALFORMED;
|
||||||
|
}
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
kKeyTime, ((int64_t)cts * 1000000) / mTimescale);
|
||||||
mBuffer->meta_data()->setInt64(
|
mBuffer->meta_data()->setInt64(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче