[FFmpeg-cvslog] fftools/ffmpeg: Fix crash when flushing non-fully setup output stream

Andreas Rheinhardt git at videolan.org
Fri Oct 8 19:36:59 EEST 2021


ffmpeg | branch: release/4.4 | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Fri Oct  8 09:47:33 2021 +0200| [4b583e54253746e82850f5a24999affe2d7e2558] | committer: James Almer

fftools/ffmpeg: Fix crash when flushing non-fully setup output stream

The output stream's packet may not have been allocated
at that point. This happens when quitting in the following command line:
$ ./ffmpeg -lavfi abuffer=sample_fmt=u8:sample_rate=48000:channel_layout=stereo -f null -

Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
(cherry picked from commit fb215798c7a72b32e889b72efd018f26bb3f88ce)

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

 fftools/ffmpeg.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 9a34d1f13e..dec012a299 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1974,6 +1974,9 @@ static void flush_encoders(void)
             AVPacket *pkt = ost->pkt;
             int pkt_size;
 
+            if (!pkt)
+                break;
+
             switch (enc->codec_type) {
             case AVMEDIA_TYPE_AUDIO:
                 desc   = "audio";



More information about the ffmpeg-cvslog mailing list