[libav-commits] audemux: Add a sanity check for the number of channels

Michael Niedermayer git at libav.org
Mon Apr 23 09:51:24 CEST 2012


Module: libav
Branch: master
Commit: 0ca4414d0f3eeb39bbad504eaaae76d40b7189cc

Author:    Michael Niedermayer <michaelni at gmx.at>
Committer: Martin Storsjö <martin at martin.st>
Date:      Mon Apr 23 10:33:55 2012 +0300

audemux: Add a sanity check for the number of channels

Fixes a division by 0.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Martin Storsjö <martin at martin.st>

---

 libavformat/au.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/libavformat/au.c b/libavformat/au.c
index 3a83d28..bb9d5d5 100644
--- a/libavformat/au.c
+++ b/libavformat/au.c
@@ -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);



More information about the libav-commits mailing list