From 0ca4414d0f3eeb39bbad504eaaae76d40b7189cc Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Mon, 23 Apr 2012 10:33:55 +0300 Subject: [PATCH] audemux: Add a sanity check for the number of channels MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes a division by 0. Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Martin Storsjö --- libavformat/au.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/au.c b/libavformat/au.c index 3a83d283bb..bb9d5d5b56 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);