[FFmpeg-cvslog] avformat/mm: Check for existence of audio stream

Andreas Rheinhardt git at videolan.org
Fri Jul 10 22:54:44 EEST 2020


ffmpeg | branch: release/4.2 | Andreas Rheinhardt <andreas.rheinhardt at gmail.com> | Thu Jul  9 12:07:28 2020 +0200| [40e049856e4f78f2a91d0f7b8b80915e87c59d04] | committer: Andreas Rheinhardt

avformat/mm: Check for existence of audio stream

No audio stream is created unconditionally and if none has been created,
no packet with stream_index 1 may be returned. This fixes an assert in
ff_read_packet() in libavformat/utils reported in ticket #8782.

Reviewed-by: Michael Niedermayer <michael at niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
(cherry picked from commit ec59dc73f0cc8930bf5dae389cd76d049d537ca7)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>

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

 libavformat/mm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mm.c b/libavformat/mm.c
index 83b3c200c6..d09e98a2ce 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -174,6 +174,8 @@ static int read_packet(AVFormatContext *s,
             return 0;
 
         case MM_TYPE_AUDIO :
+            if (s->nb_streams < 2)
+                return AVERROR_INVALIDDATA;
             if (av_get_packet(s->pb, pkt, length)<0)
                 return AVERROR(ENOMEM);
             pkt->stream_index = 1;



More information about the ffmpeg-cvslog mailing list