History

lavf/mov: Do not fail hard for more invalid atoms.

This is what several other players do and what FFmpeg already does for the sidx atom. Fixes ticket #7679.

Carl Eugen Hoyos committed 7 years ago

Commit 5d958f01 parent c15972f1 file · +9 −9Browse files

Unified · Split

libavformat/mov.c+9−9
@@ -4550,17 +4550,17 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 4549 unmodified lines
4550 track_id = avio_rb32(pb);4550 track_id = avio_rb32(pb);
4551 if (!track_id)4551 if (!track_id)
4552 return AVERROR_INVALIDDATA;4552 return AVERROR_INVALIDDATA;
4553 frag->track_id = track_id;
4554 set_frag_stream(&c->frag_index, track_id);
4555 for (i = 0; i < c->trex_count; i++)4553 for (i = 0; i < c->trex_count; i++)
4556 if (c->trex_data[i].track_id == frag->track_id) {4554 if (c->trex_data[i].track_id == track_id) {
4557 trex = &c->trex_data[i];4555 trex = &c->trex_data[i];
4558 break;4556 break;
4559 }4557 }
4560 if (!trex) {4558 if (!trex) {
4561 av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n");4559 av_log(c->fc, AV_LOG_WARNING, "could not find corresponding trex (id %u)\n", track_id);
4562 return AVERROR_INVALIDDATA;4560 return 0;
4563 }4561 }
4562 frag->track_id = track_id;
4563 set_frag_stream(&c->frag_index, track_id);
4564 4564
4565 frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ?4565 frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ?
4566 avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ?4566 avio_rb64(pb) : flags & MOV_TFHD_DEFAULT_BASE_IS_MOOF ?
@@ -4639,8 +4639,8 @@ static int mov_read_tfdt(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 72 unmodified lines
4639 }4639 }
4640 }4640 }
4641 if (!st) {4641 if (!st) {
4642 av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id);4642 av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id);
4643 return AVERROR_INVALIDDATA;4643 return 0;
4644 }4644 }
4645 sc = st->priv_data;4645 sc = st->priv_data;
4646 if (sc->pseudo_stream_id + 1 != frag->stsd_id && sc->pseudo_stream_id != -1)4646 if (sc->pseudo_stream_id + 1 != frag->stsd_id && sc->pseudo_stream_id != -1)
@@ -4686,8 +4686,8 @@ static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom) · 39 unmodified lines
4686 }4686 }
4687 }4687 }
4688 if (!st) {4688 if (!st) {
4689 av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id);4689 av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id);
4690 return AVERROR_INVALIDDATA;4690 return 0;
4691 }4691 }
4692 sc = st->priv_data;4692 sc = st->priv_data;
4693 if (sc->pseudo_stream_id+1 != frag->stsd_id && sc->pseudo_stream_id != -1)4693 if (sc->pseudo_stream_id+1 != frag->stsd_id && sc->pseudo_stream_id != -1)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t