Commit ed9b2a51 authored by Vittorio Giovara's avatar Vittorio Giovara

mov: Rework the check for invalid indexes in stsc

There are samples with invalid stsc that may work fine as is and
do not need extradata change. So ignore any out of range index, and
error out only when explode is set.
Found-by: 's avatarMatthieu Bouron <matthieu.bouron@stupeflix.com>
Signed-off-by: 's avatarVittorio Giovara <vittorio.giovara@gmail.com>
parent 90bc4232
......@@ -1949,8 +1949,13 @@ static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
sc->stsc_data[i].first = avio_rb32(pb);
sc->stsc_data[i].count = avio_rb32(pb);
sc->stsc_data[i].id = avio_rb32(pb);
if (sc->stsc_data[i].id > sc->stsd_count)
return AVERROR_INVALIDDATA;
if (sc->stsc_data[i].id < 0 || sc->stsc_data[i].id > sc->stsd_count) {
sc->stsc_data[i].id = 0;
if (c->fc->error_recognition & AV_EF_EXPLODE) {
av_log(c->fc, AV_LOG_ERROR, "Invalid stsc index.\n");
return AVERROR_INVALIDDATA;
}
}
}
sc->stsc_count = i;
......
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