From patchwork Thu Oct 20 18:11:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Cadhalpun X-Patchwork-Id: 1090 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.133 with SMTP id o127csp751245vsd; Thu, 20 Oct 2016 11:11:31 -0700 (PDT) X-Received: by 10.194.85.193 with SMTP id j1mr1082401wjz.23.1476987091157; Thu, 20 Oct 2016 11:11:31 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id vv3si62859828wjb.70.2016.10.20.11.11.30; Thu, 20 Oct 2016 11:11:31 -0700 (PDT) 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 32F45689C4A; Thu, 20 Oct 2016 21:11:26 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3EC9E689BDF for ; Thu, 20 Oct 2016 21:11:19 +0300 (EEST) Received: by mail-lf0-f68.google.com with SMTP id l131so1358592lfl.0 for ; Thu, 20 Oct 2016 11:11:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:subject:to:references:message-id:date:user-agent:mime-version :in-reply-to; bh=RPnW8+UD/j959ohXQFKxj0SZCd2PsEKf6AAeN7MTUbg=; b=UTpaWJlJulz4pBmNttyIGdgEKMP4rTAu+toGUZa0dM9/6W2bsFIu16XqeFZvdINtBd yldCMtAbggcd5BB4qbU78iLS+kQZO13oohDujbBzOYzV4wUO6SbM02HcBJVdR3N90n2/ vAB+FfhwjG5k9lvy9gGf7SPCjgm1PybZ3Fdb6gftJgUIeiOZiPIG0ZLeTomSv6SEVJUF FrAgTJ2wT30ku8fGawzxYI++qDin2aW8UE8xcqLW1DU3zWZswAzHcItRk/y+lM9vEmXZ XZU8F6zLmI0wyyILZHXTzuRoii2ZGa6LXxOwj5sYotqHmKv09Zpp6ZK3Mn+DVG82M+8+ fQyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to; bh=RPnW8+UD/j959ohXQFKxj0SZCd2PsEKf6AAeN7MTUbg=; b=Ly90ZHmkOWyAWdzsu9uWAzo6qDBD1YqHZaug77Rk1umIiOWQyyW0CTUr4Cg+C/EzNl 2Jcp7sKRpNEPuaBF0k3xPglKpz3EhgiAWRed0jjy2jfiocY6DGQPdMqyup9HRnE01ydX FSf72VdPT4mHdM+abndVrIB/mXt1/poM/pHN5gUYtpCXT0nwT4Pt2Jvf/1GIQu23wGEg V7FV2ct4kR/S8Rs3/cWhGAopHZGC4IwtVW4BChYfl8CxuJSGTRK32KNEyozjeRxAe9Hu 9MCiImm63ugydT0YzTHZdvJH7wKsVTO2sYtUm/aC6oe2XT7QsUFe5v9IqqMy7gFv2lNW wZiw== X-Gm-Message-State: AA6/9Rnn9Mp29QvAs+HqHvUPgP3NN63jdvaR6saqj/Qt1UzFxvZ5Vow71Ok8tZybTVIZBA== X-Received: by 10.25.151.149 with SMTP id z143mr1753966lfd.38.1476987081736; Thu, 20 Oct 2016 11:11:21 -0700 (PDT) Received: from [192.168.2.21] (pD9E8EB48.dip0.t-ipconnect.de. [217.232.235.72]) by smtp.googlemail.com with ESMTPSA id w65sm12611601lff.16.2016.10.20.11.11.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Oct 2016 11:11:21 -0700 (PDT) From: Andreas Cadhalpun X-Google-Original-From: Andreas Cadhalpun To: ffmpeg-devel@ffmpeg.org References: <20161020005641.GN4602@nb4> Message-ID: <9be862e6-95d4-d779-b47b-bb0c777ae0ab@googlemail.com> Date: Thu, 20 Oct 2016 20:11:19 +0200 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: <20161020005641.GN4602@nb4> Subject: Re: [FFmpeg-devel] [PATCH] aiffdec: fix division by zero 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" On 20.10.2016 02:56, Michael Niedermayer wrote: > On Wed, Oct 19, 2016 at 09:18:51PM +0200, Andreas Cadhalpun wrote: >> This is similar to commit c143a9c. >> >> Signed-off-by: Andreas Cadhalpun >> --- >> libavformat/aiffdec.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > can aiff work without block_align ? Well, it can use a fall-back value. That value can be wrong, of course. > either way, block_duration is from the header reading > if its still accurate then using it together with 1 instead of the > matching block align is quite likely not correct > OTOH if block_duration does not represent the actual content then > the duration would only be correct by pure chance > > Its a bit unfortunate that theres no usecase with an undamaged sample > which would have clear correct values > > one has to work on the assumptation of a use case where the user needs > to override the codec and then ask "what is correct to do" that makes > this a bit tricky ... Alternatively aiff_read_packet could just error out, if you prefer that. Patch doing that attached. Best regards, Andreas From d1edb842a886de0bae6e32ac602f2fef6810081a Mon Sep 17 00:00:00 2001 From: Andreas Cadhalpun Date: Thu, 20 Oct 2016 20:08:15 +0200 Subject: [PATCH] aiff: check block_align in aiff_read_packet It can be unset in avcodec_parameters_from_context and a value of 0 causes SIGFPE crashes. Signed-off-by: Andreas Cadhalpun --- libavformat/aiffdec.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavformat/aiffdec.c b/libavformat/aiffdec.c index de82787..59e969d 100644 --- a/libavformat/aiffdec.c +++ b/libavformat/aiffdec.c @@ -371,6 +371,11 @@ static int aiff_read_packet(AVFormatContext *s, if (max_size <= 0) return AVERROR_EOF; + if (!st->codecpar->block_align) { + av_log(s, AV_LOG_ERROR, "block_align not set\n"); + return AVERROR_INVALIDDATA; + } + /* Now for that packet */ switch (st->codecpar->codec_id) { case AV_CODEC_ID_ADPCM_IMA_QT: -- 2.9.3