mm: Skip unexpected audio packets
authorLuca Barbato <lu_zero@gentoo.org>
Mon, 17 Apr 2017 19:25:35 +0000 (19:25 +0000)
committerLuca Barbato <lu_zero@gentoo.org>
Thu, 20 Apr 2017 15:39:18 +0000 (15:39 +0000)
Bug-Id: 1046
CC: libav-stable@libav.org
libavformat/mm.c

index 1650550..a94d261 100644 (file)
@@ -174,6 +174,12 @@ static int read_packet(AVFormatContext *s,
             return 0;
 
         case MM_TYPE_AUDIO :
+            if (s->nb_streams != 2) {
+                av_log(s, AV_LOG_ERROR,
+                       "Unexpected audio packet, skipping\n");
+                avio_skip(pb, length);
+                return AVERROR_INVALIDDATA;
+            }
             if (av_get_packet(s->pb, pkt, length)<0)
                 return AVERROR(ENOMEM);
             pkt->size = length;