mm: Skip unexpected audio packets

Message ID 20170420160811.5A1575DB0C@aruru.libav.org
State Committed
Commit fb811fb8073123d147cc796a8fe163191ce7e855
Headers show

Commit Message

Janne Grunau April 20, 2017, 4:08 p.m.
Module: libav
Branch: master
Commit: 1731c3530bffb876deb9e00dfffdf9841a8412cd

Author:    Luca Barbato <lu_zero@gentoo.org>
Committer: Luca Barbato <lu_zero@gentoo.org>
Date:      Mon Apr 17 19:25:35 2017 +0000

mm: Skip unexpected audio packets

Bug-Id: 1046
CC: libav-stable@libav.org

---

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

Patch

diff --git a/libavformat/mm.c b/libavformat/mm.c
index 1650550..a94d261 100644
--- a/libavformat/mm.c
+++ b/libavformat/mm.c
@@ -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;