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 5ACCC49141 for ; Sat, 4 May 2024 15:38:43 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C404268D5F0; Sat, 4 May 2024 18:38:41 +0300 (EEST) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id B1BE068D394 for ; Sat, 4 May 2024 18:38:35 +0300 (EEST) Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-34c8592b8dbso475290f8f.3 for ; Sat, 04 May 2024 08:38:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714837114; x=1715441914; darn=ffmpeg.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:from:to:cc:subject :date:message-id:reply-to; bh=d0Z/B5Ia/R3e3Rn3k5MaOCFVSQ83vbOz0FSLpjevbwM=; b=KPIeiHxvbdbJ2jmVooG0XeQPU2xQ+iwKli/+eG+3KisfooydEbdhZf+V7u86eSlpPZ NiSN3x3I8DG2wHOjAYCDVACHA63PBgA31iTKzWmI3nVZXCdGl8UwQRLpIXABN/BIRMnO 7gilzKuGD3lweD+wyEySasqpfDoaZ7QLf8HICkJFoDsNMq2fiQiNjEJQl16OFPKMcd3q Pzg2Bdw0M4ew/8cqaptG6R4DGmDsjkUz14cz3xJR5WtTH/+fPiyRcIr9pQngUgK3YT+o f4LFDJINJXL38es5Yj1BtR9pQLpYzH5ohROJ2C84HKtnvI8YOL/42gbCVZn5fw2w1nsd 5rQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714837114; x=1715441914; h=user-agent:in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=d0Z/B5Ia/R3e3Rn3k5MaOCFVSQ83vbOz0FSLpjevbwM=; b=hu8rZJcuLfud3YVdNMp+FFsb9JiQs216jA5EGaCad0tFKoTk4yzHAA6Hq2+ECVeP7e 0frN2wJfcBZXG9G45YvORMXtFqtMR2Ub4D56GOwddb8bLVqDzfv+3t++16A1z0fNfUOF maR5UtXo6dofPRGWMBuZGOTIb8uFPQMKkgDJRHeSFq+tzV1njr2+TbbIl8bXCgqf5Iag CmdGs1BDXS+f67a4q1CL49qmiy+M1Wg0oWOiPkQ0+NZiVi4my4auzETgu5RyrkGGgwyY t15w2sJRDqbhPpheGgjOL18skUsjmrphwODRPXHWSDEG+JxmxCyN/D3/aun/eDU8uO3N F9ww== X-Gm-Message-State: AOJu0YxGXo+K2iYOInp1IkktdGFM+lqIxPyp0atdUF1oiftc1BcWs/VC FtnjOouQidOXIY212PuF1NXrKzIDvMnBxywOcak08DFeIWkCszTWGpZdPA== X-Google-Smtp-Source: AGHT+IE6UFkeLCPhr/PRPFHhAf3Pq2DxjcIweXPtqQ4LoIaYdY/Z49F+8XwXXiHfMKHIJGSbmpMmZA== X-Received: by 2002:adf:e38d:0:b0:34d:9160:8dad with SMTP id e13-20020adfe38d000000b0034d91608dadmr4389117wrm.12.1714837114013; Sat, 04 May 2024 08:38:34 -0700 (PDT) Received: from mariano ([188.210.239.11]) by smtp.gmail.com with ESMTPSA id o10-20020a5d684a000000b0034a7a95c8cfsm6470854wrw.9.2024.05.04.08.38.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 08:38:33 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id D5B64BFCE8; Sat, 4 May 2024 17:38:32 +0200 (CEST) Date: Sat, 4 May 2024 17:38:32 +0200 From: Stefano Sabatini To: FFmpeg development discussions and patches Message-ID: Mail-Followup-To: FFmpeg development discussions and patches References: <20240503163623.376990-1-derek.buitenhuis@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240503163623.376990-1-derek.buitenhuis@gmail.com> User-Agent: Mutt/2.1.4 (2021-12-11) 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: On date Friday 2024-05-03 17:36:23 +0100, Derek Buitenhuis wrote: > 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, > 1024*1024); > print_q("display_aspect_ratio", dar, ':'); > } else { LGTM, thanks. _______________________________________________ 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".