Commit a7f27453 authored by Michael Niedermayer's avatar Michael Niedermayer

avformat/mov: Check that we have a stream before accessing it in mov_read_ares()

Fixes out of array read
Fixes: signal_sigsegv_6f1855_3910_avid_test_alpha.mov

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 64821f5a
......@@ -1042,6 +1042,7 @@ static int mov_read_targa_y216(MOVContext *c, AVIOContext *pb, MOVAtom atom)
static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
if (c->fc->nb_streams >= 1) {
AVCodecContext *codec = c->fc->streams[c->fc->nb_streams-1]->codec;
if (codec->codec_tag == MKTAG('A', 'V', 'i', 'n') &&
codec->codec_id == AV_CODEC_ID_H264 &&
......@@ -1052,6 +1053,7 @@ static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom)
codec->width = 1440;
return 0;
}
}
return mov_read_avid(c, pb, atom);
}
......
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