diff options
author | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2019-01-14 12:44:01 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <ceffmpeg@gmail.com> | 2019-01-14 22:30:27 +0100 |
commit | 5d958f0955fe0e7552e7ccb8fddf9947e90039fc (patch) | |
tree | 17f884cd734dbd2dfc2adf2e1516a2b02074f00b | |
parent | c15972f0af7679b466dd4a10a54ab2f04f9372c8 (diff) | |
download | ffmpeg-5d958f0955fe0e7552e7ccb8fddf9947e90039fc.tar.gz |
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.
-rw-r--r-- | libavformat/mov.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 970cd87f70..9b9739f788 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -4550,17 +4550,17 @@ static int mov_read_tfhd(MOVContext *c, AVIOContext *pb, MOVAtom atom) track_id = avio_rb32(pb); if (!track_id) return AVERROR_INVALIDDATA; - frag->track_id = track_id; - set_frag_stream(&c->frag_index, track_id); for (i = 0; i < c->trex_count; i++) - if (c->trex_data[i].track_id == frag->track_id) { + if (c->trex_data[i].track_id == track_id) { trex = &c->trex_data[i]; break; } if (!trex) { - av_log(c->fc, AV_LOG_ERROR, "could not find corresponding trex\n"); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding trex (id %u)\n", track_id); + return 0; } + frag->track_id = track_id; + set_frag_stream(&c->frag_index, track_id); frag->base_data_offset = flags & MOV_TFHD_BASE_DATA_OFFSET ? 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) } } if (!st) { - av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id); + return 0; } sc = st->priv_data; 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) } } if (!st) { - av_log(c->fc, AV_LOG_ERROR, "could not find corresponding track id %u\n", frag->track_id); - return AVERROR_INVALIDDATA; + av_log(c->fc, AV_LOG_WARNING, "could not find corresponding track id %u\n", frag->track_id); + return 0; } sc = st->priv_data; if (sc->pseudo_stream_id+1 != frag->stsd_id && sc->pseudo_stream_id != -1) |