[libav-commits] au: do not arbitrarily limit channel count

Justin Ruggles git at libav.org
Wed Jan 9 17:57:52 CET 2013


Module: libav
Branch: master
Commit: fb48f825e33c15146b8ce4e5258332ebc4a9b5ea

Author:    Justin Ruggles <justin.ruggles at gmail.com>
Committer: Justin Ruggles <justin.ruggles at gmail.com>
Date:      Sun Dec 23 13:26:44 2012 -0500

au: do not arbitrarily limit channel count

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 |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/au.c b/libavformat/au.c
index fb35a9a..c429ce1 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -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)
 {



More information about the libav-commits mailing list