[FFmpeg-devel] [PATCH] ffmpeg: Fix dereference before NULL check

Michael Niedermayer michael at niedermayer.cc
Thu Mar 30 19:57:40 EEST 2017


Fixes CID1401675

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 ffmpeg.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 11faf0d4a8..b11a6a1409 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -1848,14 +1848,14 @@ static void flush_encoders(void)
         // Try to enable encoding with no input frames.
         // Maybe we should just let encoding fail instead.
         if (!ost->initialized) {
-            FilterGraph *fg = ost->filter->graph;
             char error[1024] = "";
 
             av_log(NULL, AV_LOG_WARNING,
                    "Finishing stream %d:%d without any data written to it.\n",
                    ost->file_index, ost->st->index);
 
-            if (ost->filter && !fg->graph) {
+            if (ost->filter && !ost->filter->graph->graph) {
+                FilterGraph *fg = ost->filter->graph;
                 int x;
                 for (x = 0; x < fg->nb_inputs; x++) {
                     InputFilter *ifilter = fg->inputs[x];
-- 
2.11.0



More information about the ffmpeg-devel mailing list