Commit 183720eb authored by Michael Niedermayer's avatar Michael Niedermayer

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: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 3e8e1a66
......@@ -241,11 +241,12 @@ 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++;
av_add_index_entry(s->streams[film->video_stream_index],
film->sample_table[i].sample_offset,
film->sample_table[i].pts,
film->sample_table[i].sample_size, 0,
film->sample_table[i].keyframe);
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,
film->sample_table[i].sample_size, 0,
film->sample_table[i].keyframe);
}
}
......
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