From patchwork Thu Dec 15 01:19:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1799 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.86 with SMTP id o83csp482461vsa; Wed, 14 Dec 2016 17:20:06 -0800 (PST) X-Received: by 10.28.67.69 with SMTP id q66mr191590wma.22.1481764806173; Wed, 14 Dec 2016 17:20:06 -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 z133si10035876wmc.158.2016.12.14.17.20.05; Wed, 14 Dec 2016 17:20:06 -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 A5EAC689A84; Thu, 15 Dec 2016 03:19:57 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wj0-f196.google.com (mail-wj0-f196.google.com [209.85.210.196]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 95227689A75 for ; Thu, 15 Dec 2016 03:19:51 +0200 (EET) Received: by mail-wj0-f196.google.com with SMTP id j10so7445946wjb.3 for ; Wed, 14 Dec 2016 17:19:57 -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=7Y/gk39mVbWtFGbk3S3Y3JkzkH89/A7i+f8czM8205I=; b=crp3Bx/yKciTXfzpma3jocyr2VjEM5CW+RqkL3yPkO3sXpeO7Z8yJuzOpMZQ2IAqwY TCEyxM9irNJONBrWZKxXcc8GdZ4DPcZC9W3n7viaYZFDkvyhTlItm2wAhaX4AzG7jNFX lQuwA4gP+xkE0cpy5pSaKsD+djxa6gVVN3E3mT+Afn45B5W38Rfm2d0y1R5YwvR0rQ7T qWTyqMXncU5ug5NPdqBwdDay/Da1f8Eovf050wyQFae4Y+iju3jJIL+/Z/ucatB0bM9i qG/UteFEtldHiZC0SAhixYyIXlTWL+R04Cnr34ECXpu12Fdx3lzNRaksV98pE7vRZdf6 mblg== 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=7Y/gk39mVbWtFGbk3S3Y3JkzkH89/A7i+f8czM8205I=; b=hjC7pwra7T8gkQ5qJhCCIiIV5MCwI/rSGrddRzx+Md26N38fE/5+xvSZu9MCPx/bdV EkS2tHdauxnk/nNtiXLNxIjn7AhIdmB9rjTxzrYnJPlWxllG6jdzCfQtS0xuqj6TqN11 m4e/avmJ940dlCkTWkLCNV1Ccr+6HfDT6DIeiqzgYh8uLQxjnKM8GeijtHsumZCVW0e+ D6YmhjeQ04kfl4ERdWvhyCDTBpS8FRwSpQr4eP3YppYnin7tw+Kiy9Lh0GYEcCz/YddZ 2SiHdxhooL/yIDAU/qbvlOaNfIH44VW2m0lHXk87QrVFUEfcri47Ly2hfY+VdYzWtfd7 ZNvA== X-Gm-Message-State: AKaTC01S+rj2iGGO7JNMDCr8JOS46CTAqBg1qQgEjiegnC30OSx3wguZT13/YoS4OkTCJg== X-Received: by 10.194.248.233 with SMTP id yp9mr9585941wjc.228.1481764796959; Wed, 14 Dec 2016 17:19:56 -0800 (PST) Received: from [192.168.2.21] (p5B095A24.dip0.t-ipconnect.de. [91.9.90.36]) by smtp.googlemail.com with ESMTPSA id c133sm20995wme.12.2016.12.14.17.19.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Dec 2016 17:19:56 -0800 (PST) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: FFmpeg development discussions and patches References: <609c350e-1785-22f4-afeb-169005483a85@googlemail.com> Message-ID: <1cd2cebb-86ff-37f5-cdda-bf72cb58fe0f@googlemail.com> Date: Thu, 15 Dec 2016 02:19:55 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.4.0 MIME-Version: 1.0 In-Reply-To: <609c350e-1785-22f4-afeb-169005483a85@googlemail.com> Subject: [FFmpeg-devel] [PATCH 6/6] pvfdec: 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/pvfdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/pvfdec.c b/libavformat/pvfdec.c index b9f6d4f..5eecc22 100644 --- a/libavformat/pvfdec.c +++ b/libavformat/pvfdec.c @@ -56,6 +56,11 @@ static int pvf_read_header(AVFormatContext *s) st->codecpar->sample_rate = sample_rate; st->codecpar->codec_id = ff_get_pcm_codec_id(bps, 0, 1, 0xFFFF); st->codecpar->bits_per_coded_sample = bps; + if (bps > INT_MAX / st->codecpar->channels) { + av_log(s, AV_LOG_ERROR, "Overflow during block alignment calculation %d * %d\n", + bps, st->codecpar->channels); + return AVERROR_INVALIDDATA; + } st->codecpar->block_align = bps * st->codecpar->channels / 8; avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);