Commit 5d958f09 authored by Carl Eugen Hoyos's avatar Carl Eugen Hoyos

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.
parent c15972f0
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment