Hi!

Attached patch fixes a crash if SDL sends a keydown event before
stream and window initialization is finished, ticket #7252.

Please comment, Carl Eugen
From 43324194a81f1f33150fefac6336285ab95eb14f Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <ceffm...@gmail.com>
Date: Mon, 11 Jun 2018 01:44:24 +0200
Subject: [PATCH] ffplay: Don't crash if stream_cycle_channel() is called
 before initialization.

SDL may send a keydown event before stream (and window) initialization is finished.

Fixes ticket #7252.
---
 fftools/ffplay.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/fftools/ffplay.c b/fftools/ffplay.c
index 84ba667..5ace5cd 100644
--- a/fftools/ffplay.c
+++ b/fftools/ffplay.c
@@ -3106,7 +3106,11 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
     int old_index;
     AVStream *st;
     AVProgram *p = NULL;
-    int nb_streams = is->ic->nb_streams;
+    int nb_streams;
+
+    if (!is->ic)
+        return;
+    nb_streams = is->ic->nb_streams;
 
     if (codec_type == AVMEDIA_TYPE_VIDEO) {
         start_index = is->last_video_stream;
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to