ffmpeg | branch: release/4.2 | Peter Ross <pr...@xvid.org> | Sat Apr 25 
11:25:15 2020 +1000| [1fc446d7e232f8b5e8d5c3d46b139e6249658f5f] | committer: 
Marton Balint

ffplay: set stream_index to -1 earlier to prevent segfault

Signed-off-by: Peter Ross <pr...@xvid.org>
Reviewed-by: Marton Balint <c...@passwd.hu>
(cherry picked from commit 6cfb33f976812a52bceba29b3db3bbdb84ab7c32)

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

 fftools/ffplay.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index fee0619f7c..a5d6852c18 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -2760,9 +2760,6 @@ static int read_thread(void *arg)
     }
 
     memset(st_index, -1, sizeof(st_index));
-    is->last_video_stream = is->video_stream = -1;
-    is->last_audio_stream = is->audio_stream = -1;
-    is->last_subtitle_stream = is->subtitle_stream = -1;
     is->eof = 0;
 
     ic = avformat_alloc_context();
@@ -3068,6 +3065,9 @@ static VideoState *stream_open(const char *filename, 
AVInputFormat *iformat)
     is = av_mallocz(sizeof(VideoState));
     if (!is)
         return NULL;
+    is->last_video_stream = is->video_stream = -1;
+    is->last_audio_stream = is->audio_stream = -1;
+    is->last_subtitle_stream = is->subtitle_stream = -1;
     is->filename = av_strdup(filename);
     if (!is->filename)
         goto fail;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to