avformat/segafilm: Only add index entries when the stream exists

Fixes null pointer dereference
Fixes: cb02dfb163ac833c04cace3d7e35b160/signal_sigsegv_e55c49_6326_8f25619fc86a00b303c57b7778baf70a.cpk

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-11-07 13:35:10 +01:00
parent 3e8e1a660e
commit 183720eb6e
1 changed files with 6 additions and 5 deletions

View File

@ -241,6 +241,7 @@ static int film_read_header(AVFormatContext *s)
film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
film->sample_table[i].keyframe = (scratch[8] & 0x80) ? 0 : 1;
video_frame_counter++;
if (film->video_type)
av_add_index_entry(s->streams[film->video_stream_index],
film->sample_table[i].sample_offset,
film->sample_table[i].pts,