From patchwork Sun Nov 13 18:23:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1405 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp711304vsb; Sun, 13 Nov 2016 10:24:02 -0800 (PST) X-Received: by 10.194.165.228 with SMTP id zb4mr16656848wjb.31.1479061442720; Sun, 13 Nov 2016 10:24:02 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id bt18si20363616wjb.137.2016.11.13.10.24.02; Sun, 13 Nov 2016 10:24:02 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BCA94689D78; Sun, 13 Nov 2016 20:24:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f68.google.com (mail-wm0-f68.google.com [74.125.82.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8FED3689D05 for ; Sun, 13 Nov 2016 20:23:54 +0200 (EET) Received: by mail-wm0-f68.google.com with SMTP id g23so9685532wme.1 for ; Sun, 13 Nov 2016 10:23:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=ubKYbnxY5jDwEl5jfexGMx7FnbTTNx6ZBQ1wyF9laMc=; b=eek044kDGtM37RbY/f+SDBvyJ/DDShJEZudAaBF+uiIz4X8dedm8PSUGH1aDxyEEh+ I6+j4Uv3vw0eR7siYaL+apwRcAIWduMlE3HrVkChlLUMRVI2YVFhwoN3lCfxnwDw2jaJ xe2063bYqG0AlHxGyVP0tQZlxOTYDUqiyESUv6TLOplaaM0CdddfgEPIMipzxUivk24F 8+/si4v90aVIi0jMhVh6n04mDTYgL7UbehFB49QWr7t6iSNxt2rViCy59Cd+TywXLKe9 N9QiA3x+ukUOARvTkDntaJCSBwC2uuXq3PvrMhNVQWr4RRRAYL2w2HV1cQ99WP2j32eh TAdA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=ubKYbnxY5jDwEl5jfexGMx7FnbTTNx6ZBQ1wyF9laMc=; b=NVjCcNPDfhLAZ+iZfMNtfvhPKev+6HtGPjNfVXFo3YxUgPjU0AaP0s2OWNTjFHpGAT HIbmGjGqNVxMCLTlZIJCjTqBFf5BlKSReX7uB4V5FQD1Ez96AAcKR7AeQb9K5zIuE6iN q7W01i8dgFY7iZSu07Y7P5pCwDQfpULrjIb8SQruegz33wnLf4TG0GYN3xXVwaPfok45 +yved9/6lXEzNCc/sfJS0Ap3mAieyYWX9wzAp1kEt9WnP9HqGcJ1Al6RLgOj/+UaShHE +wxY8QAH2szTkOH8+RV8N5bm/bs4ndhpmktv1JETfz7pN0k08v5Pwd8W0iwF0JAObzfw ZVJw== X-Gm-Message-State: ABUngvfx12d/vM1Gj2BKmXsKFsJL4SNGbq7o5xnvlAKJMf6Hkj93N7Xy5yn6X4n5gT+bbg== X-Received: by 10.28.230.197 with SMTP id e66mr7601122wmi.12.1479061434062; Sun, 13 Nov 2016 10:23:54 -0800 (PST) Received: from [192.168.2.21] (p5B072E6F.dip0.t-ipconnect.de. [91.7.46.111]) by smtp.googlemail.com with ESMTPSA id t84sm2818596wmt.7.2016.11.13.10.23.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 13 Nov 2016 10:23:53 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches , libav development Message-ID: Date: Sun, 13 Nov 2016 19:23:52 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] libopusdec: fix out-of-bounds read X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" avc->channels can be 0. Signed-off-by: Andreas Cadhalpun --- libavcodec/libopusdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c index acc62f1..505ed57 100644 --- a/libavcodec/libopusdec.c +++ b/libavcodec/libopusdec.c @@ -50,7 +50,7 @@ static av_cold int libopus_decode_init(AVCodecContext *avc) avc->sample_rate = 48000; avc->sample_fmt = avc->request_sample_fmt == AV_SAMPLE_FMT_FLT ? AV_SAMPLE_FMT_FLT : AV_SAMPLE_FMT_S16; - avc->channel_layout = avc->channels > 8 ? 0 : + avc->channel_layout = (avc->channels > 8 || avc->channels < 1) ? 0 : ff_vorbis_channel_layouts[avc->channels - 1]; if (avc->extradata_size >= OPUS_HEAD_SIZE) {