[FFmpeg-cvslog] avformat/segafilm: Only add index entries when the stream exists

Michael Niedermayer git at videolan.org
Sat Nov 7 14:12:15 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Sat Nov  7 13:35:10 2015 +0100| [183720eb6efedcabe3db8643676e55a4d9d2896d] | committer: 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: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=183720eb6efedcabe3db8643676e55a4d9d2896d
---

 libavformat/segafilm.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/libavformat/segafilm.c b/libavformat/segafilm.c
index 6aef48e..f59b45f 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);
         }
     }
 



More information about the ffmpeg-cvslog mailing list