From patchwork Fri Jan 31 07:16:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan Doshi X-Patchwork-Id: 17627 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id 6A34E44AF20 for ; Fri, 31 Jan 2020 09:16:43 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 453ED68A59E; Fri, 31 Jan 2020 09:16:43 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DC6F168A540 for ; Fri, 31 Jan 2020 09:16:36 +0200 (EET) Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-CHACHA20-POLY1305 (256/256 bits)) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4887nH3rflzQl34 for ; Fri, 31 Jan 2020 08:16:35 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id ogB8qRBPS-Lj for ; Fri, 31 Jan 2020 08:16:32 +0100 (CET) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org Date: Fri, 31 Jan 2020 12:46:13 +0530 Message-Id: <20200131071614.715-1-ffmpeg@gyani.pro> In-Reply-To: <158021607658.31696.14090930319828867396@lain.red.khirnov.net> References: <158021607658.31696.14090930319828867396@lain.red.khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v2] avfilter/scale: fix CID 1457833 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" Remove expressions with constant results and improve overflow checks. --- libavfilter/vf_scale.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c index 0348f19d33..b6c6414258 100644 --- a/libavfilter/vf_scale.c +++ b/libavfilter/vf_scale.c @@ -497,10 +497,8 @@ static int config_props(AVFilterLink *outlink) scale->force_original_aspect_ratio, scale->force_divisible_by); - if (scale->w > INT_MAX || - scale->h > INT_MAX || - (scale->h * inlink->w) > INT_MAX || - (scale->w * inlink->h) > INT_MAX) + if ((scale->h > INT_MAX / inlink->w) || + (scale->w > INT_MAX / inlink->h)) av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n"); outlink->w = scale->w;