From patchwork Thu Jan 26 01:11:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 2313 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp2470980vsb; Wed, 25 Jan 2017 17:12:04 -0800 (PST) X-Received: by 10.223.172.136 with SMTP id o8mr182733wrc.76.1485393124786; Wed, 25 Jan 2017 17:12:04 -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 x200si994899wme.45.2017.01.25.17.12.04; Wed, 25 Jan 2017 17:12:04 -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 sp=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 037E568A68F; Thu, 26 Jan 2017 03:12:02 +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 DCCBC68A649 for ; Thu, 26 Jan 2017 03:11:55 +0200 (EET) Received: by mail-wm0-f68.google.com with SMTP id c85so46508742wmi.1 for ; Wed, 25 Jan 2017 17:11:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=50Lv8igjGySjvTrf2fuiecA8qpjwWqD6IAjMiSHNBAw=; b=uDERSJp6Fw9Fb1nFuTpms/ohdSXy/EI+ZhyJxasHsg3xBYml1MgUklglGndQ31xYQj GWgrId0ijCufv+xmZ+o3Wudt2C0pybJZnoEdssSlY1qZp5L/XRQnZet9oIxFUHAE0m+K 4rDKlr1wlNIa3S4xnaPV9rHEJ1YkEHMbKEXaITRuwGGlPAXpDY6qv7gpcGywBk5JAL5V Kk84NlKHHWHOe1uszwThqqT5lsGSqkNHj70RrP/btolt6TLi5eVA79Q7XNIdOnQxSKDg mnlfa7IgVaTPKs/tWULolqWTc0kDtRrQhr7cfurvctNOyp81Eamz2+uz4rEbdrxLuq6s H7Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=50Lv8igjGySjvTrf2fuiecA8qpjwWqD6IAjMiSHNBAw=; b=ESqxUvBSr3GyR9ARFGNPS1BiTBSie3/zEoWF4qjmQGPTcz/IR/HQYIAn7Y7T/++3ZP vrrVbRzyEJXQDuWYDF/Hwstaz70IaAv8VdSoR5OhocEY3f5qCAHER9lWMh2XalY0anDh t6T/JvQBrC3A4ZHyXJvoGfMGnQtbEV+SA4Qfg/uKTGtqlpPsyMXzqr2Pv2U9PKwbA+Lu D1qF3zItKXwObJYB8Z7vxWWsaGaYd/Og/vZWVo2JTumPDgux6h0AUWoc5ioWqFgcNeTd NNr/oiwMhnBM/7ZzIEl+NJRuYGRnUIwdxUsI1tqc7PBOSKA30zOtlSBcFzft9iox8q0L IgIQ== X-Gm-Message-State: AIkVDXKavb1mvGAEjQG0rMEiNtzgt5zxYv9r1tfebTsJ5yXZC/A4CoSrKbtYu+Eoze618g== X-Received: by 10.223.135.146 with SMTP id b18mr146936wrb.189.1485393115934; Wed, 25 Jan 2017 17:11:55 -0800 (PST) Received: from [192.168.2.21] (p5B0954C8.dip0.t-ipconnect.de. [91.9.84.200]) by smtp.googlemail.com with ESMTPSA id r5sm33677800wme.23.2017.01.25.17.11.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Jan 2017 17:11:55 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches References: Message-ID: <892c8420-1cd2-39a4-dfe5-2e80d4557bfc@googlemail.com> Date: Thu, 26 Jan 2017 02:11:54 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 In-Reply-To: Subject: [FFmpeg-devel] [PATCH 3/9] genh: prevent overflow during block alignment calculation 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" Signed-off-by: Andreas Cadhalpun --- libavformat/genh.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/genh.c b/libavformat/genh.c index b683e026d1..dd4e76d3d9 100644 --- a/libavformat/genh.c +++ b/libavformat/genh.c @@ -20,6 +20,7 @@ */ #include "libavutil/intreadwrite.h" +#include "libavcodec/internal.h" #include "avformat.h" #include "internal.h" @@ -54,7 +55,7 @@ static int genh_read_header(AVFormatContext *s) st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; st->codecpar->channels = avio_rl32(s->pb); - if (st->codecpar->channels <= 0) + if (st->codecpar->channels <= 0 || st->codecpar->channels > FF_SANE_NB_CHANNELS) return AVERROR_INVALIDDATA; if (st->codecpar->channels == 1) st->codecpar->channel_layout = AV_CH_LAYOUT_MONO;