diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-07 13:35:10 +0100 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2015-11-07 14:09:17 +0100 |
commit | 183720eb6efedcabe3db8643676e55a4d9d2896d (patch) | |
tree | fa7952f4bec7d3ed75dd26fb1653acb558d096e9 /libavformat/segafilm.c | |
parent | 3e8e1a660ea182111057d56ec1cfad2c62250f4c (diff) | |
download | ffmpeg-183720eb6efedcabe3db8643676e55a4d9d2896d.tar.gz |
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>
Diffstat (limited to 'libavformat/segafilm.c')
-rw-r--r-- | libavformat/segafilm.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c index 6aef48eba9..f59b45f6f9 100644 --- a/libavformat/segafilm.c +++ b/libavformat/segafilm.c @@ -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); } } |