]> git.sesse.net Git - ffmpeg/commitdiff
au: do not arbitrarily limit channel count
authorJustin Ruggles <justin.ruggles@gmail.com>
Sun, 23 Dec 2012 18:26:44 +0000 (13:26 -0500)
committerJustin Ruggles <justin.ruggles@gmail.com>
Wed, 9 Jan 2013 16:52:57 +0000 (11:52 -0500)
Nothing in the AU specification sets a limit on channel count.
We only need to avoid an overflow in the packet size calculation.

libavformat/au.c

index fb35a9a61306f0418e3193743affbf7785f576d0..c429ce100dda4ae2f3ff7114e1d0726e8675e3f1 100644 (file)
@@ -57,6 +57,8 @@ static int au_probe(AVProbeData *p)
         return 0;
 }
 
+#define BLOCK_SIZE 1024
+
 /* au input */
 static int au_read_header(AVFormatContext *s)
 {
@@ -92,7 +94,7 @@ static int au_read_header(AVFormatContext *s)
         return AVERROR_PATCHWELCOME;
     }
 
-    if (channels == 0 || channels > 64) {
+    if (channels == 0 || channels >= INT_MAX / (BLOCK_SIZE * bps >> 3)) {
         av_log(s, AV_LOG_ERROR, "Invalid number of channels %d\n", channels);
         return AVERROR_INVALIDDATA;
     }
@@ -117,8 +119,6 @@ static int au_read_header(AVFormatContext *s)
     return 0;
 }
 
-#define BLOCK_SIZE 1024
-
 static int au_read_packet(AVFormatContext *s,
                           AVPacket *pkt)
 {