From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 3F6B04AECF for ; Thu, 23 May 2024 07:52:37 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B09A268D3CA; Thu, 23 May 2024 10:52:34 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4B06468CD10 for ; Thu, 23 May 2024 10:52:28 +0300 (EEST) Authentication-Results: mail0.khirnov.net; dkim=pass (2048-bit key; unprotected) header.d=khirnov.net header.i=@khirnov.net header.a=rsa-sha256 header.s=mail header.b=nqw9313s; dkim-atps=neutral Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 10DC4240DAC for ; Thu, 23 May 2024 09:52:28 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavis, port 10024) with ESMTP id WitpCraRkEwK for ; Thu, 23 May 2024 09:52:26 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=khirnov.net; s=mail; t=1716450746; bh=WDvX+o3PV6JFvHUBGKfYrhHkTGUFEtLWJKZkypzke94=; h=Subject:From:To:In-Reply-To:References:Date:From; b=nqw9313syJbsAG3NvGEdCc8ckNjai28+jghfbdTqpwsdYahkZ8z/PZT0yldPKzxsh LUo/EWmFoWjwhK9td1cUsARiJOjZPNoNUmpomCRnVH6+d4bKcV50pTT0Xd1kiMP5ut VN0GM9FiB3pnOrZh5v/Psj7vYyGHG5PFxi07RP2Hkk/suQTsF+KJixYa74BcFdtvyx zwEZLVmwCc67TdRhB8zKA3Ur0LwVu3Q74aD9PcUjdFzvy9n1U3t6Icq/CvQGCA80DE 7Hh6ZWTQ8Gvc3Q0gnbGppDNWBsGhhjhVVVwOOr2+rBWnIpiZzy1jrxkc7PNKDhRll8 NCcXHHAwczFnQ== Received: from lain.khirnov.net (lain.khirnov.net [IPv6:2001:67c:1138:4306::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "lain.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 43E3D2404E5 for ; Thu, 23 May 2024 09:52:26 +0200 (CEST) Received: by lain.khirnov.net (Postfix, from userid 1000) id 1DD5A1601B9; Thu, 23 May 2024 09:52:26 +0200 (CEST) From: Anton Khirnov To: FFmpeg development discussions and patches In-Reply-To: <20240503163623.376990-1-derek.buitenhuis@gmail.com> References: <20240503163623.376990-1-derek.buitenhuis@gmail.com> Mail-Followup-To: FFmpeg development discussions and patches Date: Thu, 23 May 2024 09:52:26 +0200 Message-ID: <171645074609.22242.813739036708191284@lain.khirnov.net> User-Agent: alot/0.8.1 MIME-Version: 1.0 Subject: Re: [FFmpeg-devel] [PATCH] fftools/ffprobe: Avoid overflow when calculating DAR X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: Quoting Derek Buitenhuis (2024-05-03 18:36:23) > Both the codecpar's width and height, and the SAR num and den are > ints, which can overflow. Cast to int64_t, which is what av_reduce > takes. > > Without this, occasionally, display_aspect_ratio can be negative in > ffprobe's -show_stream output. > > Signed-off-by: Derek Buitenhuis > --- > fftools/ffprobe.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c > index 0d4cd0b048..5b40dad527 100644 > --- a/fftools/ffprobe.c > +++ b/fftools/ffprobe.c > @@ -3324,8 +3324,8 @@ static int show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_id > if (sar.num) { > print_q("sample_aspect_ratio", sar, ':'); > av_reduce(&dar.num, &dar.den, > - par->width * sar.num, > - par->height * sar.den, > + (int64_t) par->width * sar.num, > + (int64_t) par->height * sar.den, Aren't we supposed to avoid assumptions that int is always strictly smaller than 64bit? -- Anton Khirnov _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".