audemux: Add a sanity check for the number of channels
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 23 Apr 2012 07:33:55 +0000 (10:33 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 23 Apr 2012 07:47:38 +0000 (10:47 +0300)
Fixes a division by 0.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/au.c

index 3a83d28..bb9d5d5 100644 (file)
@@ -145,6 +145,11 @@ static int au_read_header(AVFormatContext *s)
         return AVERROR_INVALIDDATA;
     }
 
+    if (channels == 0 || channels > 64) {
+        av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);
+        return AVERROR_INVALIDDATA;
+    }
+
     if (size >= 24) {
         /* skip unused data */
         avio_skip(pb, size - 24);