]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mm: Check for existence of audio stream
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Thu, 9 Jul 2020 10:07:28 +0000 (12:07 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 10 Jul 2020 18:36:31 +0000 (20:36 +0200)
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@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/mm.c

index d40fd12acccd8b8b6de6ed2459d19c64f2543482..02ffbcd82427f3e79987f2ccfb241384694fd69e 100644 (file)
@@ -175,6 +175,8 @@ static int read_packet(AVFormatContext *s,
             return 0;
 
         case MM_TYPE_AUDIO :
+            if (s->nb_streams < 2)
+                return AVERROR_INVALIDDATA;
             if ((ret = av_get_packet(s->pb, pkt, length)) < 0)
                 return ret;
             pkt->stream_index = 1;